File tree Expand file tree Collapse file tree 2 files changed +3
-16
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 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 {
3535
3636 override def runsAfter : Set [String ] = Set (ElimRepeated .name)
3737
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-
4538 override def transformMatch (tree : Match )(using Context ): Tree =
4639 if (tree.isInstanceOf [InlineMatch ]) tree
4740 else {
@@ -53,13 +46,10 @@ class PatternMatcher extends MiniPhase {
5346 case rt => tree.tpe
5447 val translated = new Translator (matchType, this ).translateMatch(tree)
5548
56- if ! inInlinedCode then
49+ // Skip analysis on inlined code (eg pos/i19157)
50+ if ! tpd.enclosingInlineds.nonEmpty then
5751 // check exhaustivity and unreachability
5852 SpaceEngine .checkMatch(tree)
59- else
60- // only check exhaustivity, as inlining may generate unreachable code
61- // like in i19157.scala
62- SpaceEngine .checkMatchExhaustivityOnly(tree)
6353
6454 translated.ensureConforms(matchType)
6555 }
Original file line number Diff line number Diff line change @@ -902,9 +902,6 @@ object SpaceEngine {
902902 }
903903
904904 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 =
909905 if exhaustivityCheckable(m.selector) then checkExhaustivity(m)
906+ if reachabilityCheckable(m.selector) then checkReachability(m)
910907}
You can’t perform that action at this time.
0 commit comments