diff options
author | Paul Phillips <paulp@improving.org> | 2011-07-13 06:58:04 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-07-13 06:58:04 +0000 |
commit | d8e882ad5ccd7006a4304d9378a7a9328f55e173 (patch) | |
tree | a18c07da73515be37e48b1bd1c15ed1e8f3df0ce /src | |
parent | e032852d12a301fb8ee8b10fe1f6a6f6eb09b7d4 (diff) | |
download | scala-d8e882ad5ccd7006a4304d9378a7a9328f55e173.tar.gz scala-d8e882ad5ccd7006a4304d9378a7a9328f55e173.tar.bz2 scala-d8e882ad5ccd7006a4304d9378a7a9328f55e173.zip |
Bounded wildcard types arising during pattern t...
Bounded wildcard types arising during pattern type inference can cause
unnecessary crashes. Closes #1048, review by odersky.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 5bbc0b6430..97e07d9f3e 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -2566,10 +2566,13 @@ trait Typers extends Modes { val formals1 = formalTypes(formals0, args.length) if (sameLength(formals1, args)) { val args1 = typedArgs(args, mode, formals0, formals1) - assert(isFullyDefined(pt), tree+" ==> "+UnApply(fun1, args1)+", pt = "+pt) + // This used to be the following (failing) assert: + // assert(isFullyDefined(pt), tree+" ==> "+UnApply(fun1, args1)+", pt = "+pt) + // I modified as follows. See SI-1048. + val pt1 = if (isFullyDefined(pt)) pt else makeFullyDefined(pt) - val itype = glb(List(pt, arg.tpe)) - arg.tpe = pt // restore type (arg is a dummy tree, just needs to pass typechecking) + val itype = glb(List(pt1, arg.tpe)) + arg.tpe = pt1 // restore type (arg is a dummy tree, just needs to pass typechecking) UnApply(fun1, args1) setPos tree.pos setType itype } else { |