Skip to content

TypeApplications#noHK: return false for Nothing #966

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

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 3 additions & 3 deletions src/dotty/tools/dotc/core/TypeApplications.scala
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ class TypeApplications(val self: Type) extends AnyVal {
}

/** True if it can be determined without forcing that the class symbol
* of this application exists and is not a lambda trait.
* of this application exists and is not a lambda trait or Nothing.
* Equivalent to
*
* self.classSymbol.exists && !self.classSymbol.isLambdaTrait
* self.classSymbol.exists && !self.classSymbol.isLambdaTrait && !self.isRef(defn.NothingClass)
*
* but without forcing anything.
*/
Expand All @@ -179,7 +179,7 @@ class TypeApplications(val self: Type) extends AnyVal {
case self: TypeRef =>
(self.denot.exists) && {
val sym = self.symbol
if (sym.isClass) !sym.isLambdaTrait
if (sym.isClass) !sym.isLambdaTrait && !sym.eq(defn.NothingClass)
else sym.isCompleted && self.info.isAlias && self.info.bounds.hi.noHK
}
case _ =>
Expand Down
5 changes: 5 additions & 0 deletions tests/pos/hk_nothing.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
object Test {
def foo[M[_]]: M[Int] = ???
foo[Nothing]
foo
}