File tree 2 files changed +3
-16
lines changed
compiler/src/dotty/tools/dotc/transform
2 files changed +3
-16
lines changed Original file line number Diff line number Diff line change @@ -35,13 +35,6 @@ class PatternMatcher extends MiniPhase {
35
35
36
36
override def runsAfter : Set [String ] = Set (ElimRepeated .name)
37
37
38
- private val InInlinedCode = new util.Property .Key [Boolean ]
39
- private def inInlinedCode (using Context ) = ctx.property(InInlinedCode ).getOrElse(false )
40
-
41
- override def prepareForInlined (tree : Inlined )(using Context ): Context =
42
- if inInlinedCode then ctx
43
- else ctx.fresh.setProperty(InInlinedCode , true )
44
-
45
38
override def transformMatch (tree : Match )(using Context ): Tree =
46
39
if (tree.isInstanceOf [InlineMatch ]) tree
47
40
else {
@@ -53,13 +46,10 @@ class PatternMatcher extends MiniPhase {
53
46
case rt => tree.tpe
54
47
val translated = new Translator (matchType, this ).translateMatch(tree)
55
48
56
- if ! inInlinedCode then
49
+ // Skip analysis on inlined code (eg pos/i19157)
50
+ if ! tpd.enclosingInlineds.nonEmpty then
57
51
// check exhaustivity and unreachability
58
52
SpaceEngine .checkMatch(tree)
59
- else
60
- // only check exhaustivity, as inlining may generate unreachable code
61
- // like in i19157.scala
62
- SpaceEngine .checkMatchExhaustivityOnly(tree)
63
53
64
54
translated.ensureConforms(matchType)
65
55
}
Original file line number Diff line number Diff line change @@ -902,9 +902,6 @@ object SpaceEngine {
902
902
}
903
903
904
904
def checkMatch (m : Match )(using Context ): Unit =
905
- checkMatchExhaustivityOnly(m)
906
- if reachabilityCheckable(m.selector) then checkReachability(m)
907
-
908
- def checkMatchExhaustivityOnly (m : Match )(using Context ): Unit =
909
905
if exhaustivityCheckable(m.selector) then checkExhaustivity(m)
906
+ if reachabilityCheckable(m.selector) then checkReachability(m)
910
907
}
You can’t perform that action at this time.
0 commit comments