Skip to content

Fix #6083: Dealias before kind checking #6099

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion compiler/src/dotty/tools/dotc/core/TypeApplications.scala
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,10 @@ class TypeApplications(val self: Type) extends AnyVal {

/** Is self type of kind "*"? */
def hasSimpleKind(implicit ctx: Context): Boolean =
typeParams.isEmpty && !self.hasAnyKind
typeParams.isEmpty && !self.hasAnyKind || {
val alias = self.dealias
(alias ne self) && alias.hasSimpleKind
}

/** If self type is higher-kinded, its result type, otherwise NoType.
* Note: The hkResult of an any-kinded type is again AnyKind.
Expand Down
3 changes: 3 additions & 0 deletions tests/pos/i6083.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type K[T <: AnyKind] = T
val a: K[Int] = 1
val b: K[List][Int] = Nil