File tree 3 files changed +2
-17
lines changed
compiler/src/dotty/tools/dotc
3 files changed +2
-17
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ import SymUtils._
13
13
import Flags ._ , Constants ._
14
14
import Decorators ._
15
15
import NameKinds .{PatMatStdBinderName , PatMatAltsName , PatMatResultName }
16
- import typer .Nullables
17
16
import config .Printers .patmatch
18
17
import reporting ._
19
18
import dotty .tools .dotc .ast ._
@@ -44,12 +43,8 @@ class PatternMatcher extends MiniPhase {
44
43
case rt => tree.tpe
45
44
val translated = new Translator (matchType, this ).translateMatch(tree)
46
45
47
- val engineCtx =
48
- if tree.hasAttachment(Nullables .UnsafeNullsMatch )
49
- then ctx.retractMode(Mode .SafeNulls ) else ctx
50
-
51
46
// check exhaustivity and unreachability
52
- val engine = new patmat.SpaceEngine ()( using engineCtx)
47
+ val engine = new patmat.SpaceEngine
53
48
engine.checkExhaustivity(tree)
54
49
engine.checkRedundancy(tree)
55
50
Original file line number Diff line number Diff line change @@ -20,13 +20,6 @@ import ast.Trees.mods
20
20
object Nullables :
21
21
import ast .tpd ._
22
22
23
- /** An attachment that represents a match tree is created under Unsafe Nulls.
24
- * This is used to pass Unsafe Nulls information to PatternMatcher Phase,
25
- * so we don't get Match case Unreachable Warning when using `case null => ???`
26
- * on non-nullable type.
27
- */
28
- val UnsafeNullsMatch = Property .StickyKey [Unit ]
29
-
30
23
inline def unsafeNullsEnabled (using Context ): Boolean =
31
24
ctx.explicitNulls && ! ctx.mode.is(Mode .SafeNulls )
32
25
Original file line number Diff line number Diff line change @@ -1499,7 +1499,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
1499
1499
}
1500
1500
1501
1501
def typedMatch (tree : untpd.Match , pt : Type )(using Context ): Tree =
1502
- val tree1 = tree.selector match {
1502
+ tree.selector match {
1503
1503
case EmptyTree =>
1504
1504
if (tree.isInline) {
1505
1505
checkInInlineContext(" summonFrom" , tree.srcPos)
@@ -1601,9 +1601,6 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
1601
1601
result
1602
1602
}
1603
1603
}
1604
- if Nullables .unsafeNullsEnabled && ctx.phase == Phases .typerPhase then
1605
- tree1.putAttachment(Nullables .UnsafeNullsMatch , ())
1606
- tree1
1607
1604
1608
1605
/** Special typing of Match tree when the expected type is a MatchType,
1609
1606
* and the patterns of the Match tree and the MatchType correspond.
You can’t perform that action at this time.
0 commit comments