File tree 2 files changed +8
-16
lines changed
compiler/src/dotty/tools/dotc/core
2 files changed +8
-16
lines changed Original file line number Diff line number Diff line change @@ -66,24 +66,10 @@ object NullOpsDecorator {
66
66
case tp : TypeProxy => tp.underlying.isNullableAfterErasure
67
67
case OrType (lhs, rhs) =>
68
68
lhs.isNullableAfterErasure || rhs.isNullableAfterErasure
69
+ case AndType (lhs, rhs) =>
70
+ lhs.isNullableAfterErasure && rhs.isNullableAfterErasure
69
71
case _ =>
70
72
self.isNullType || self <:< defn.ObjectType
71
73
}
72
-
73
- // def isUnsafelyNulltoAnyRef(pt: Type)(using Context): Boolean =
74
- // self.isNullType && pt.isNullableAfterErasure
75
-
76
- // def isUnsafeSubtype(pt: Type, relaxedSubtype: Boolean = false)(using Context): Boolean =
77
- // val selfs = self.stripAllNulls
78
- // val pts = pt.stripAllNulls
79
- // if relaxedSubtype then
80
- // selfs relaxed_<:< pts
81
- // else
82
- // selfs <:< pts
83
-
84
- // /** Can we convert a tree with type `self` to type `pt` unsafely.
85
- // */
86
- // def unsafeNullsSubType(pt: Type, relaxed: Boolean = false)(using Context): Boolean =
87
- // self.isUnsafelyNulltoAnyRef(pt) || self.isUnsafeSubtype(pt, relaxed)
88
74
}
89
75
}
Original file line number Diff line number Diff line change
1
+ object Issue10001 {
2
+ val a : String = " Issue10001"
3
+ val b : String | Null = a
4
+ val c = s " $a"
5
+ val d = s " $b"
6
+ }
You can’t perform that action at this time.
0 commit comments