diff options
author | Martin Odersky <odersky@gmail.com> | 2014-01-01 18:06:30 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-01-01 18:06:30 +0100 |
commit | 3a0e9fbb0018e15c17aea659569202c315ad59f1 (patch) | |
tree | 4942c82ba431cf3bbafa56cbf89ddcf305fee21d /tests | |
parent | a5611f867c2b9e493d5f0497ddfb813b5daf347d (diff) | |
download | dotty-3a0e9fbb0018e15c17aea659569202c315ad59f1.tar.gz dotty-3a0e9fbb0018e15c17aea659569202c315ad59f1.tar.bz2 dotty-3a0e9fbb0018e15c17aea659569202c315ad59f1.zip |
Constraints need to be ignored when forming lubs and glbs of constrained oarameter bounds.
Otherwise we would get into situations like the following (experienced in typers.Arrays):
Constraint:
B >: String
T >: B
Add B >: T to this constraint. You get:
B >: String | T,
but because T >: B >: String, the rhs reduces to
B >: T
Simplified this gives
B = T
and the String lower bound has vanished!
Diffstat (limited to 'tests')
-rw-r--r-- | tests/pos/typers.scala | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/pos/typers.scala b/tests/pos/typers.scala index d7b7989c7..2e0a7c0fd 100644 --- a/tests/pos/typers.scala +++ b/tests/pos/typers.scala @@ -108,5 +108,11 @@ object typers { } - + + object Arrays { + + val arr = List("a", "b", "c").toArray + val i = 2 + arr(i).charAt(0) + } }
\ No newline at end of file |