File tree 2 files changed +18
-11
lines changed
compiler/src/dotty/tools/dotc/typer
2 files changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -409,10 +409,17 @@ trait Applications extends Compatibility {
409
409
/** The function's type after widening and instantiating polytypes
410
410
* with TypeParamRefs in constraint set
411
411
*/
412
- @ threadUnsafe lazy val methType : Type = liftedFunType.widen match {
413
- case funType : MethodType => funType
414
- case funType : PolyType => instantiateWithTypeVars(funType)
415
- case tp => tp // was: funType
412
+ @ threadUnsafe lazy val methType : Type = {
413
+ def rec (t : Type ): Type = {
414
+ t.widen match {
415
+ case funType : MethodType => funType
416
+ case funType : PolyType =>
417
+ rec(instantiateWithTypeVars(funType))
418
+ case tp => tp
419
+ }
420
+ }
421
+
422
+ rec(liftedFunType)
416
423
}
417
424
418
425
@ threadUnsafe lazy val liftedFunType : Type =
@@ -1077,8 +1084,6 @@ trait Applications extends Compatibility {
1077
1084
val typedArgs = if (isNamed) typedNamedArgs(tree.args) else tree.args.mapconserve(typedType(_))
1078
1085
record(" typedTypeApply" )
1079
1086
typedExpr(tree.fun, PolyProto (typedArgs, pt)) match {
1080
- case _ : TypeApply if ! ctx.isAfterTyper =>
1081
- errorTree(tree, " illegal repeated type application" )
1082
1087
case typedFn =>
1083
1088
typedFn.tpe.widen match {
1084
1089
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
- f[X = Int ][X = Int ][Y = String ](1 , " " ) // error: illegal repeated type application
20
+ /* Conflicts with Clause Interweaving, stems from named type parameters assuming one type clause
21
+ f[X = Int][X = Int][Y = String](1, "")
21
22
22
- f[X = Int ][Y = String ](1 , " " ) // error: illegal repeated type application
23
- f[X = Int ][String ](1 , " " ) // error: illegal repeated type application
23
+ f[X = Int][Y = String](1, "")
24
+ f[X = Int][String](1, "")
24
25
25
- f[Y = String ][X = Int ](1 , " " ) // error: illegal repeated type application
26
- f[Y = String ][Int ](1 , " " ) // error: illegal repeated type application
26
+ f[Y = String][X = Int](1, "")
27
+ f[Y = String][Int](1, "")
28
+ */
27
29
}
You can’t perform that action at this time.
0 commit comments