Skip to content

Commit 9316033

Browse files
committed
also cook the tree of a java raw type
[Cherry-picked e8e295a][modified]
1 parent 30c95c8 commit 9316033

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4214,14 +4214,16 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
42144214
val tree1 =
42154215
if ((pt eq AnyTypeConstructorProto) || tp.typeParamSymbols.isEmpty) tree
42164216
else {
4217-
val tp1 =
4218-
if (ctx.isJava)
4219-
// Cook raw type
4220-
AppliedType(tree.tpe, tp.typeParams.map(Function.const(TypeBounds.empty)))
4221-
else
4222-
// Eta-expand higher-kinded type
4223-
tree.tpe.EtaExpand(tp.typeParamSymbols)
4224-
tree.withType(tp1)
4217+
if (ctx.isJava)
4218+
// Cook raw type
4219+
val typeArgs = tp.typeParams.map(Function.const(TypeBounds.empty))
4220+
val tree1 = AppliedTypeTree(tree, typeArgs.map(TypeTree(_)))
4221+
val tp1 = AppliedType(tree.tpe, typeArgs)
4222+
tree1.withType(tp1)
4223+
else
4224+
// Eta-expand higher-kinded type
4225+
val tp1 = tree.tpe.EtaExpand(tp.typeParamSymbols)
4226+
tree.withType(tp1)
42254227
}
42264228
if (ctx.mode.is(Mode.Pattern) || ctx.mode.is(Mode.QuotedPattern) || tree1.tpe <:< pt) tree1
42274229
else err.typeMismatch(tree1, pt)

sbt-test/pipelining/Yjava-tasty-paths/b/Test.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ object B {
4343
val cd_ii_Raw: RawTypes#C[?]#D[?] = cd_ii
4444

4545
RawTypes.mii_Raw_Raw(cd_ii_Raw)
46-
// RawTypes.mii_Raw_Raw2(cd_ii_Raw) // error: dotty still doesnt rewrite the tree of a raw type to a type with wildcards
46+
RawTypes.mii_Raw_Raw2(cd_ii_Raw)
4747
}
4848
}
4949

0 commit comments

Comments
 (0)