Skip to content

Commit

Permalink
Fix explicit null matching issue
Browse files Browse the repository at this point in the history
  • Loading branch information
HarrisL2 committed Dec 20, 2024
1 parent 090dbf4 commit e8fbff1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 0 additions & 1 deletion compiler/src/dotty/tools/dotc/core/TypeComparer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,6 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
def isNullable(tp: Type): Boolean = tp.dealias match
case tp: TypeRef =>
val tpSym = tp.symbol
!tpSym.isPrimitiveValueClass ||
tpSym.isNullableClass
case tp: TermRef =>
// https://scala-lang.org/files/archive/spec/2.13/03-types.html#singleton-types
Expand Down
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,8 @@ object Types extends TypeUtils {
*/
def matches(that: Type)(using Context): Boolean = {
record("matches")
TypeComparer.matchesType(this, that, relaxed = !ctx.phase.erasedTypes)
withoutMode(Mode.SafeNulls)(
TypeComparer.matchesType(this, that, relaxed = !ctx.phase.erasedTypes))
}

/** This is the same as `matches` except that it also matches => T with T and
Expand Down

0 comments on commit e8fbff1

Please sign in to comment.