File tree 2 files changed +8
-2
lines changed
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -527,7 +527,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
527
527
}
528
528
isSubType(hi1, tp2) || compareGADT
529
529
case _ =>
530
- def isNullable (tp : Type ): Boolean = tp.dealias match {
530
+ def isNullable (tp : Type ): Boolean = tp.widenDealias match {
531
531
case tp : TypeRef => tp.symbol.isNullableClass
532
532
case tp : RefinedOrRecType => isNullable(tp.parent)
533
533
case AndType (tp1, tp2) => isNullable(tp1) && isNullable(tp2)
Original file line number Diff line number Diff line change @@ -103,7 +103,13 @@ class InterceptedMethods extends MiniPhaseTransform {
103
103
case Any_## =>
104
104
poundPoundValue(qual)
105
105
case Any_!= =>
106
- qual.select(defn.Any_== ).appliedToArgs(tree.args).select(defn.Boolean_! )
106
+ val lhs = qual.tpe
107
+ val rhs = tree.args.head.tpe
108
+ if (! (lhs <:< rhs || rhs <:< lhs)) {
109
+ ctx.warning(ex " comparing values of types ${lhs.widenDealias} and ${rhs.widenDealias} using `!=' will always yield true " ,
110
+ tree.pos)
111
+ }
112
+ qual.select(defn.Any_== ).appliedToArgs(tree.args).select(defn.Boolean_! )
107
113
/*
108
114
/* else if (isPrimitiveValueClass(qual.tpe.typeSymbol)) {
109
115
// todo: this is needed to support value classes
You can’t perform that action at this time.
0 commit comments