File tree Expand file tree Collapse file tree 2 files changed +18
-11
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -419,10 +419,17 @@ trait Applications extends Compatibility {
419
419
/** The function's type after widening and instantiating polytypes
420
420
* with TypeParamRefs in constraint set
421
421
*/
422
- @ threadUnsafe lazy val methType : Type = liftedFunType.widen match {
423
- case funType : MethodType => funType
424
- case funType : PolyType => instantiateWithTypeVars(funType)
425
- case tp => tp // was: funType
422
+ @ threadUnsafe lazy val methType : Type = {
423
+ def rec (t : Type ): Type = {
424
+ t.widen match {
425
+ case funType : MethodType => funType
426
+ case funType : PolyType =>
427
+ rec(instantiateWithTypeVars(funType))
428
+ case tp => tp
429
+ }
430
+ }
431
+
432
+ rec(liftedFunType)
426
433
}
427
434
428
435
@ threadUnsafe lazy val liftedFunType : Type =
@@ -1102,8 +1109,6 @@ trait Applications extends Compatibility {
1102
1109
val typedArgs = if (isNamed) typedNamedArgs(tree.args) else tree.args.mapconserve(typedType(_))
1103
1110
record(" typedTypeApply" )
1104
1111
typedExpr(tree.fun, PolyProto (typedArgs, pt)) match {
1105
- case _ : TypeApply if ! ctx.isAfterTyper =>
1106
- errorTree(tree, " illegal repeated type application" )
1107
1112
case typedFn =>
1108
1113
typedFn.tpe.widen match {
1109
1114
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