From 3a0e9fbb0018e15c17aea659569202c315ad59f1 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 1 Jan 2014 18:06:30 +0100 Subject: 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! --- tests/pos/typers.scala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests') 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 -- cgit v1.2.3