File tree Expand file tree Collapse file tree 3 files changed +2
-17
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 3 files changed +2
-17
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ import SymUtils._
1313import Flags ._ , Constants ._
1414import Decorators ._
1515import NameKinds .{PatMatStdBinderName , PatMatAltsName , PatMatResultName }
16- import typer .Nullables
1716import config .Printers .patmatch
1817import reporting ._
1918import dotty .tools .dotc .ast ._
@@ -44,12 +43,8 @@ class PatternMatcher extends MiniPhase {
4443 case rt => tree.tpe
4544 val translated = new Translator (matchType, this ).translateMatch(tree)
4645
47- val engineCtx =
48- if tree.hasAttachment(Nullables .UnsafeNullsMatch )
49- then ctx.retractMode(Mode .SafeNulls ) else ctx
50-
5146 // check exhaustivity and unreachability
52- val engine = new patmat.SpaceEngine ()( using engineCtx)
47+ val engine = new patmat.SpaceEngine
5348 engine.checkExhaustivity(tree)
5449 engine.checkRedundancy(tree)
5550
Original file line number Diff line number Diff line change @@ -20,13 +20,6 @@ import ast.Trees.mods
2020object Nullables :
2121 import ast .tpd ._
2222
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-
3023 inline def unsafeNullsEnabled (using Context ): Boolean =
3124 ctx.explicitNulls && ! ctx.mode.is(Mode .SafeNulls )
3225
Original file line number Diff line number Diff line change @@ -1499,7 +1499,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
14991499 }
15001500
15011501 def typedMatch (tree : untpd.Match , pt : Type )(using Context ): Tree =
1502- val tree1 = tree.selector match {
1502+ tree.selector match {
15031503 case EmptyTree =>
15041504 if (tree.isInline) {
15051505 checkInInlineContext(" summonFrom" , tree.srcPos)
@@ -1601,9 +1601,6 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
16011601 result
16021602 }
16031603 }
1604- if Nullables .unsafeNullsEnabled && ctx.phase == Phases .typerPhase then
1605- tree1.putAttachment(Nullables .UnsafeNullsMatch , ())
1606- tree1
16071604
16081605 /** Special typing of Match tree when the expected type is a MatchType,
16091606 * and the patterns of the Match tree and the MatchType correspond.
You can’t perform that action at this time.
0 commit comments