File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -1032,10 +1032,13 @@ class Namer { typer: Typer =>
10321032 val forwarder =
10331033 if mbr.isType then
10341034 val forwarderName = checkNoConflict(alias.toTypeName, isPrivate = false , span)
1035+ var target = path.tpe.select(sym)
1036+ if target.typeParams.nonEmpty then
1037+ target = target.EtaExpand (target.typeParams)
10351038 newSymbol(
10361039 cls, forwarderName,
10371040 Exported | Final ,
1038- TypeAlias (path.tpe.select(sym) ),
1041+ TypeAlias (target ),
10391042 coord = span)
10401043 // Note: This will always create unparameterzied aliases. So even if the original type is
10411044 // a parameterized class, say `C[X]` the alias will read `type C = d.C`. We currently do
Original file line number Diff line number Diff line change 1+ object example {
2+ trait MyType [A ]
3+ type Alias [A , B ] = MyType [B ]
4+ }
5+
6+ object bug {
7+ export example .{MyType , Alias }
8+ def bug [A ](m : MyType [A ]): MyType [A ] = m
9+ val bug2 : MyType [String ] => MyType [String ] = m => m
10+ def bug3 [A , B ](m : Alias [A , B ]): MyType [B ] = m
11+ def bug4 [A , B ](m : Alias [A , B ]): Alias [Int , B ] = m
12+
13+ // it works when referencing the original type in the parameter position.
14+ def thisWorks [A ](m : example.MyType [A ]): MyType [A ] = m
15+ val thisWorks2 : example.MyType [String ] => MyType [String ] = m => m
16+ val thisWorks3 : MyType [String ] = (??? : MyType [String ])
17+ }
You can’t perform that action at this time.
0 commit comments