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 @@ -443,10 +443,17 @@ trait Applications extends Compatibility {
443
443
/** The function's type after widening and instantiating polytypes
444
444
* with TypeParamRefs in constraint set
445
445
*/
446
- @ threadUnsafe lazy val methType : Type = liftedFunType.widen match {
447
- case funType : MethodType => funType
448
- case funType : PolyType => instantiateWithTypeVars(funType)
449
- case tp => tp // was: funType
446
+ @ threadUnsafe lazy val methType : Type = {
447
+ def rec (t : Type ): Type = {
448
+ t.widen match {
449
+ case funType : MethodType => funType
450
+ case funType : PolyType =>
451
+ rec(instantiateWithTypeVars(funType))
452
+ case tp => tp
453
+ }
454
+ }
455
+
456
+ rec(liftedFunType)
450
457
}
451
458
452
459
@ threadUnsafe lazy val liftedFunType : Type =
@@ -1143,8 +1150,6 @@ trait Applications extends Compatibility {
1143
1150
val typedArgs = if (isNamed) typedNamedArgs(tree.args) else tree.args.mapconserve(typedType(_))
1144
1151
record(" typedTypeApply" )
1145
1152
typedExpr(tree.fun, PolyProto (typedArgs, pt)) match {
1146
- case _ : TypeApply if ! ctx.isAfterTyper =>
1147
- errorTree(tree, em " illegal repeated type application " )
1148
1153
case typedFn =>
1149
1154
typedFn.tpe.widen match {
1150
1155
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