File tree Expand file tree Collapse file tree 3 files changed +21
-1
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -1130,6 +1130,9 @@ object SymDenotations {
1130
1130
if (cls.effectiveName == name || ! cls.exists) cls else cls.owner.enclosingClassNamed(name)
1131
1131
}
1132
1132
1133
+ final def isPolyFunction (using Context ): Boolean =
1134
+ this .asInstanceOf [ClassDenotation ].parentSyms.contains(defn.PolyFunctionClass )
1135
+
1133
1136
/** The closest enclosing method containing this definition.
1134
1137
* A local dummy owner is mapped to the primary constructor of the class.
1135
1138
*/
@@ -1144,7 +1147,7 @@ object SymDenotations {
1144
1147
*/
1145
1148
final def enclosingExtensionMethod (using Context ): Symbol =
1146
1149
if this .is(ExtensionMethod ) then symbol
1147
- else if this .isClass then NoSymbol
1150
+ else if this .isClass && ! this .isPolyFunction then NoSymbol
1148
1151
else if this .exists then owner.enclosingExtensionMethod
1149
1152
else NoSymbol
1150
1153
Original file line number Diff line number Diff line change
1
+ extension(a : Int )
2
+ def b : Int = ???
3
+ def h : Unit =
4
+ [A ] => (r : Int ) => b
Original file line number Diff line number Diff line change
1
+ type FunctionK [A [_], B [_]] = [Z ] => A [Z ] => B [Z ]
2
+ type ~>: [A [_], B [_]] = FunctionK [A , B ]
3
+
4
+ trait RepresentableK [F [_[_], _]]:
5
+ type RepresentationK [_]
6
+
7
+ def tabulateK [A [_], C ](f : RepresentationK ~>: A ): F [A , C ]
8
+
9
+ extension[A [_], C ](fa : F [A , C ])
10
+ def indexK : RepresentationK ~>: A
11
+
12
+ def mapK [B [_]] (f : A ~>: B ): F [B , C ] =
13
+ tabulateK([Z ] => (r : RepresentationK [Z ]) => f(indexK(r)))
You can’t perform that action at this time.
0 commit comments