Skip to content

Commit e8e295a

Browse files
committed
also cook the tree of a java raw type
1 parent 3ab2999 commit e8e295a

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

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

+10-8
Original file line numberDiff line numberDiff line change
@@ -4275,14 +4275,16 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
42754275
val tree1 =
42764276
if ((pt eq AnyTypeConstructorProto) || tp.typeParamSymbols.isEmpty) tree
42774277
else {
4278-
val tp1 =
4279-
if (ctx.isJava)
4280-
// Cook raw type
4281-
AppliedType(tree.tpe, tp.typeParams.map(Function.const(TypeBounds.empty)))
4282-
else
4283-
// Eta-expand higher-kinded type
4284-
tree.tpe.etaExpand(tp.typeParamSymbols)
4285-
tree.withType(tp1)
4278+
if (ctx.isJava)
4279+
// Cook raw type
4280+
val typeArgs = tp.typeParams.map(Function.const(TypeBounds.empty))
4281+
val tree1 = AppliedTypeTree(tree, typeArgs.map(TypeTree(_)))
4282+
val tp1 = AppliedType(tree.tpe, typeArgs)
4283+
tree1.withType(tp1)
4284+
else
4285+
// Eta-expand higher-kinded type
4286+
val tp1 = tree.tpe.etaExpand(tp.typeParamSymbols)
4287+
tree.withType(tp1)
42864288
}
42874289
if (ctx.mode.is(Mode.Pattern) || ctx.mode.isQuotedPattern || tree1.tpe <:< pt) tree1
42884290
else err.typeMismatch(tree1, pt)

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

+1-1
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)