From 7ebc41cda22ee26d4242e305782a14f7e6bf63aa Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 30 Oct 2006 17:29:19 +0000 Subject: fixed bugs 54, 415 Improved avoidance of MalformedType's --- test/files/neg/abstract.check | 10 +--------- test/files/neg/bug415.check | 12 ++++++++---- test/files/neg/bug415.scala | 21 +++++++++++++++++++++ test/files/pos/bug415.scala | 9 +++++++++ 4 files changed, 39 insertions(+), 13 deletions(-) create mode 100644 test/files/neg/bug415.scala create mode 100644 test/files/pos/bug415.scala (limited to 'test/files') diff --git a/test/files/neg/abstract.check b/test/files/neg/abstract.check index a64a5da85f..86fded0fce 100644 --- a/test/files/neg/abstract.check +++ b/test/files/neg/abstract.check @@ -1,19 +1,11 @@ -abstract.scala:5 error: method bar cannot be accessed in A.this.T - because its instance type ()A.this.T#T contains a malformed type: A.this.T#T - def foo1: A = bar().bar(); - ^ abstract.scala:6 error: type mismatch; found : A required: A.this.T def foo2: T = bar().baz(); ^ -abstract.scala:8 error: method bar cannot be accessed in A - because its instance type ()A#T contains a malformed type: A#T - def foo4: A = baz().bar(); - ^ abstract.scala:9 error: type mismatch; found : A required: A.this.T def foo5: T = baz().baz(); ^ -four errors found +two errors found diff --git a/test/files/neg/bug415.check b/test/files/neg/bug415.check index c6c9805aa6..76dbc64bc2 100644 --- a/test/files/neg/bug415.check +++ b/test/files/neg/bug415.check @@ -1,5 +1,9 @@ -bug415.scala:8 error: method x cannot be accessed in A +bug415.scala:10 error: method x cannot be accessed in A because its instance type => A#T contains a malformed type: A#T - val y: String = a.x; - ^ -one error found + val y = a.x; + ^ +bug415.scala:20 error: method x cannot be accessed in A2 + because its instance type => scala.Array[A2#T] contains a malformed type: A2#T + val y: Array[String] = a.x; + ^ +two errors found diff --git a/test/files/neg/bug415.scala b/test/files/neg/bug415.scala new file mode 100644 index 0000000000..ea7f89f39a --- /dev/null +++ b/test/files/neg/bug415.scala @@ -0,0 +1,21 @@ +class Foo[T] + +abstract class A { + type T <: Foo[T] + def x: T; +} + +abstract class B { + def a: A; + val y = a.x; +} + +abstract class A2 { + type T <: String + def x: Array[T] +} + +abstract class B2 { + def a: A2; + val y: Array[String] = a.x; +} diff --git a/test/files/pos/bug415.scala b/test/files/pos/bug415.scala new file mode 100644 index 0000000000..355b6136d1 --- /dev/null +++ b/test/files/pos/bug415.scala @@ -0,0 +1,9 @@ +abstract class A { + type T <: String; + def x: T; +} + +abstract class B { + def a: A; + val y: String = a.x; +} -- cgit v1.2.3