diff options
author | Paul Phillips <paulp@improving.org> | 2011-12-26 06:07:04 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-12-26 06:31:03 -0800 |
commit | f737e35ddf43599043ab78404c4f9a13e6d02c9b (patch) | |
tree | 2582eea4b07fedd9476286dec9f05abef24c738e /test/files/pos | |
parent | 8a862fd5e94a06c7fc1088623f594cd5bf864168 (diff) | |
download | scala-f737e35ddf43599043ab78404c4f9a13e6d02c9b.tar.gz scala-f737e35ddf43599043ab78404c4f9a13e6d02c9b.tar.bz2 scala-f737e35ddf43599043ab78404c4f9a13e6d02c9b.zip |
Fixed regression in lub calculation.
Changing NullaryMethodType to be a SimpleTypeProxy because nearly all
its operations forward to its result type was it seems not such a good
idea, because it also meant that calling .underlying returned the result
type rather than the method type. The way this materialized was in
subtype checks of refinement types. A lub is calculated for two nullary
method types in the course of calculating a refinement, and then the
input types are checked against the calculated lub.
However in the lub refinement, the nullary method type has become a bare
typeref, and so the subtype check failed. Closes SI-5317.
This does give me confidence that all the malformed lubs one sees
logged under -Ydebug (and there are still many, especially with type
constructors) are alerting us to real bugs elsewhere in Types.
Diffstat (limited to 'test/files/pos')
-rw-r--r-- | test/files/pos/t5317.scala | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/files/pos/t5317.scala b/test/files/pos/t5317.scala new file mode 100644 index 0000000000..8c9c9d8222 --- /dev/null +++ b/test/files/pos/t5317.scala @@ -0,0 +1,12 @@ +object Test { + trait S { type T; val x: AnyRef } + trait A extends S { type T <: A; val x: A = null } + trait B extends S { type T <: B; val x: B = null } + + val a = new A{} + val b = new B{} + val y = if (true) a else b + + // lub of y should allow for this + println(y.x.x) +} |