File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -444,10 +444,17 @@ trait Applications extends Compatibility {
444
444
/** The function's type after widening and instantiating polytypes
445
445
* with TypeParamRefs in constraint set
446
446
*/
447
- @ threadUnsafe lazy val methType : Type = liftedFunType.widen match {
448
- case funType : MethodType => funType
449
- case funType : PolyType => instantiateWithTypeVars(funType)
450
- case tp => tp // was: funType
447
+ @ threadUnsafe lazy val methType : Type = {
448
+ def rec (t : Type ): Type = {
449
+ t.widen match {
450
+ case funType : MethodType => funType
451
+ case funType : PolyType =>
452
+ rec(instantiateWithTypeVars(funType))
453
+ case tp => tp
454
+ }
455
+ }
456
+
457
+ rec(liftedFunType)
451
458
}
452
459
453
460
@ threadUnsafe lazy val liftedFunType : Type =
@@ -1144,8 +1151,6 @@ trait Applications extends Compatibility {
1144
1151
val typedArgs = if (isNamed) typedNamedArgs(tree.args) else tree.args.mapconserve(typedType(_))
1145
1152
record(" typedTypeApply" )
1146
1153
typedExpr(tree.fun, PolyProto (typedArgs, pt)) match {
1147
- case _ : TypeApply if ! ctx.isAfterTyper =>
1148
- errorTree(tree, em " illegal repeated type application " )
1149
1154
case typedFn =>
1150
1155
typedFn.tpe.widen match {
1151
1156
case pt : PolyType =>
Original file line number Diff line number Diff line change @@ -17,11 +17,13 @@ object Test {
17
17
def f [X , Y ](x : X , y : Y ): Int = ???
18
18
19
19
f[X = Int , String ](1 , " " ) // error // error
20
+ /* Conflicts with Clause Interweaving, stems from named type parameters assuming one type clause
20
21
f[X = Int][X = Int][Y = String](1, "") // error: illegal repeated type application
21
22
22
23
f[X = Int][Y = String](1, "") // error: illegal repeated type application
23
24
f[X = Int][String](1, "") // error: illegal repeated type application
24
25
25
26
f[Y = String][X = Int](1, "") // error: illegal repeated type application
26
27
f[Y = String][Int](1, "") // error: illegal repeated type application
28
+ */
27
29
}
You can’t perform that action at this time.
0 commit comments