diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-01-14 15:29:51 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-01-14 15:29:51 -0800 |
commit | 1a305a5aa8aae2a6d196918664c0c4a9cf808687 (patch) | |
tree | fa9f909cc3eb892e933a59278644820f6d419537 /src | |
parent | c20060b956edf7f3a6b427553708f4017bdf0fe0 (diff) | |
parent | 8fb19b132579b7ddb9dd12ae829451dcf9d91332 (diff) | |
download | scala-1a305a5aa8aae2a6d196918664c0c4a9cf808687.tar.gz scala-1a305a5aa8aae2a6d196918664c0c4a9cf808687.tar.bz2 scala-1a305a5aa8aae2a6d196918664c0c4a9cf808687.zip |
Merge pull request #1876 from adriaanm/ticket-5189-inf
SI-5189 detect unsoundness when inferring type of match
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index e3fd83f388..979c0f59f4 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -2552,11 +2552,7 @@ trait Typers extends Modes with Adaptations with Tags { } // body1 = checkNoEscaping.locals(context.scope, pt, body1) - val treeWithSkolems = treeCopy.CaseDef(cdef, pat1, guard1, body1) setType body1.tpe - - new TypeMapTreeSubstituter(deskolemizeGADTSkolems).traverse(treeWithSkolems) - - treeWithSkolems // now without skolems, actually + treeCopy.CaseDef(cdef, pat1, guard1, body1) setType body1.tpe } // undo adaptConstrPattern's evil deeds, as they confuse the old pattern matcher @@ -2591,7 +2587,10 @@ trait Typers extends Modes with Adaptations with Tags { val casesAdapted = if (!needAdapt) casesTyped else casesTyped map (adaptCase(_, mode, resTp)) - treeCopy.Match(tree, selector1, casesAdapted) setType resTp + val matchTyped = treeCopy.Match(tree, selector1, casesAdapted) setType resTp + if (!newPatternMatching) // TODO: remove this in 2.11 -- only needed for old pattern matcher + new TypeMapTreeSubstituter(deskolemizeGADTSkolems).traverse(matchTyped) + matchTyped } // match has been typed -- virtualize it if we're feeling experimental |