From c58b7b10249adefa1045942a1dc7a55dc5932db8 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Wed, 4 Sep 2013 08:22:27 -0700 Subject: Eliminate TypeTrees with null original. This is a retry of #2801 after figuring out the range position error. Should there be anyone out there who compiles with -Xdev, know that this commit eliminates the 1406 errors one presently incurs compiling src/library. A val declared in source code receives only one tree from the parser, but two are needed - one for the field and one for the getter. I discovered long ago that if the val had an existential type, this was creating issues with incompatible existentials between the field and the getter. However the remedy for that did not take into account the whole of the wide range of super subtle issues which accompany tree duplication. In particular, the duplicated tree must be given not only a fresh TypeTree(), but that TypeTree cannot share the same original without running afoul of range position invariants. That's because typedTypeTree resurrects the original tree with whatever position it has - so the "original" needs to be a duplicate of the original with a focused position. Should the call to TypeTree.duplicate also duplicate the original? I think so, but I bequeath this question to others. This commit also eliminated some duplicate error messages, because duplicate suppression depends on the errors having the same position. See c478eb770d, 7a6fa80937 for previous related work. --- test/files/neg/classmanifests_new_deprecations.check | 8 +------- test/files/neg/t935.check | 5 +---- 2 files changed, 2 insertions(+), 11 deletions(-) (limited to 'test/files/neg') diff --git a/test/files/neg/classmanifests_new_deprecations.check b/test/files/neg/classmanifests_new_deprecations.check index 5f9d0a1ccc..fd1e2728c3 100644 --- a/test/files/neg/classmanifests_new_deprecations.check +++ b/test/files/neg/classmanifests_new_deprecations.check @@ -7,9 +7,6 @@ classmanifests_new_deprecations.scala:3: warning: type ClassManifest in object P classmanifests_new_deprecations.scala:4: warning: type ClassManifest in object Predef is deprecated: Use `scala.reflect.ClassTag` instead val cm3: ClassManifest[Int] = null ^ -classmanifests_new_deprecations.scala:4: warning: type ClassManifest in object Predef is deprecated: Use `scala.reflect.ClassTag` instead - val cm3: ClassManifest[Int] = null - ^ classmanifests_new_deprecations.scala:6: warning: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead def rcm1[T: scala.reflect.ClassManifest] = ??? ^ @@ -19,9 +16,6 @@ classmanifests_new_deprecations.scala:7: warning: type ClassManifest in package classmanifests_new_deprecations.scala:8: warning: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead val rcm3: scala.reflect.ClassManifest[Int] = null ^ -classmanifests_new_deprecations.scala:8: warning: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead - val rcm3: scala.reflect.ClassManifest[Int] = null - ^ classmanifests_new_deprecations.scala:10: warning: type ClassManifest in object Predef is deprecated: Use `scala.reflect.ClassTag` instead type CM[T] = ClassManifest[T] ^ @@ -29,5 +23,5 @@ classmanifests_new_deprecations.scala:15: warning: type ClassManifest in package type RCM[T] = scala.reflect.ClassManifest[T] ^ error: No warnings can be incurred under -Xfatal-warnings. -10 warnings found +8 warnings found one error found diff --git a/test/files/neg/t935.check b/test/files/neg/t935.check index 8b73700187..af634a2630 100644 --- a/test/files/neg/t935.check +++ b/test/files/neg/t935.check @@ -4,7 +4,4 @@ t935.scala:7: error: type arguments [Test3.B] do not conform to class E's type p t935.scala:13: error: type arguments [Test4.B] do not conform to class E's type parameter bounds [T <: String] val b: String @E[B](new B) = "hi" ^ -t935.scala:13: error: type arguments [Test4.B] do not conform to class E's type parameter bounds [T <: String] - val b: String @E[B](new B) = "hi" - ^ -three errors found +two errors found -- cgit v1.2.3