Skip to content

Commit 127ac60

Browse files
committed
Make hasSimpleKind follow aliases
1 parent fb13bc7 commit 127ac60

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

compiler/src/dotty/tools/dotc/core/TypeApplications.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,10 @@ class TypeApplications(val self: Type) extends AnyVal {
211211

212212
/** Is self type of kind "*"? */
213213
def hasSimpleKind(implicit ctx: Context): Boolean =
214-
typeParams.isEmpty && !self.hasAnyKind
214+
typeParams.isEmpty && !self.hasAnyKind || {
215+
val alias = self.dealias
216+
(alias ne self) && alias.hasSimpleKind
217+
}
215218

216219
/** If self type is higher-kinded, its result type, otherwise NoType.
217220
* Note: The hkResult of an any-kinded type is again AnyKind.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ trait Checking {
799799

800800
/** Check that `tpt` does not define a higher-kinded type */
801801
def checkSimpleKinded(tpt: Tree)(implicit ctx: Context): Tree =
802-
if (!tpt.tpe.dealias.hasSimpleKind && !ctx.compilationUnit.isJava) {
802+
if (!tpt.tpe.hasSimpleKind && !ctx.compilationUnit.isJava) {
803803
// be more lenient with missing type params in Java,
804804
// needed to make pos/java-interop/t1196 work.
805805
errorTree(tpt, MissingTypeParameterFor(tpt.tpe))

0 commit comments

Comments
 (0)