diff options
author | Paul Phillips <paulp@improving.org> | 2012-05-04 17:44:28 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-05-04 18:24:16 -0700 |
commit | 0fb12fa0620c5f9999e309a4de7831549b283c24 (patch) | |
tree | 94a01f56b6ea8ed2dd2fdba0a8f9105e67f9d290 /test/files/neg | |
parent | ecbf89552666ebba974188ef3c98b5f4855d0cea (diff) | |
download | scala-0fb12fa0620c5f9999e309a4de7831549b283c24.tar.gz scala-0fb12fa0620c5f9999e309a4de7831549b283c24.tar.bz2 scala-0fb12fa0620c5f9999e309a4de7831549b283c24.zip |
Updated Symbol to record classfile origin.
This change should be transparent to anything using sourceFile,
unless it was drinking from the inheritance well too deeply. Rather
than squander the already allocated field for every ClassSymbol not
being compiled from source, I'm now populating it with the file
representing the class. This will make a broad range of things easier,
like debugging, issuing useful error messages, symbol invalidation,
signature verification, you name it.
def sourceFile - still returns only source code files
def binaryFile - returns only class files
def associatedFile - returns whatever is there, if anything
Performance: I may be mistaken, but I believe this is a zero-impact
change. No new fields are allocated; fields which were null now hold
a useful reference. The reference is to a file instance which was
already being allocated and already long-lived.
Compare error messages:
// Version 1
% scalac a.scala
error: type _$1 is defined twice
// Version 2
% scalac a.scala
error: type _$1 is defined twice
conflicting symbols both originated in file './foo/package.class'
Note: this may be due to a bug in the compiler involving wildcards in package objects
one error found
Bonus for people who read commit logs. Try this in the repl
after starting power mode.
ListClass.info.members groupBy (_.associatedFile) foreach {
case (k, vs) => println("%s\n %s\n".format(k, vs map (_.defString) mkString "\n "))
}
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/macro-invalidsig-context-bounds.check | 6 | ||||
-rw-r--r-- | test/files/neg/macro-invalidsig-context-bounds/Macros_Test_1.scala (renamed from test/files/neg/macro-invalidsig-context-bounds/Macros_Test_2.scala) | 0 | ||||
-rw-r--r-- | test/files/neg/overloaded-unapply.check | 3 | ||||
-rw-r--r-- | test/files/neg/primitive-sigs-1.check | 6 | ||||
-rw-r--r-- | test/files/neg/primitive-sigs-1/A.scala (renamed from test/files/neg/primitive-sigs-1/A_1.scala) | 0 | ||||
-rw-r--r-- | test/files/neg/primitive-sigs-1/B.scala (renamed from test/files/neg/primitive-sigs-1/A_3.scala) | 2 | ||||
-rw-r--r-- | test/files/neg/primitive-sigs-1/J.java (renamed from test/files/neg/primitive-sigs-1/J_2.java) | 2 | ||||
-rw-r--r-- | test/files/neg/t200.check | 3 | ||||
-rw-r--r-- | test/files/neg/t2779.check | 3 | ||||
-rw-r--r-- | test/files/neg/t278.check | 3 | ||||
-rw-r--r-- | test/files/neg/t5504.check | 4 | ||||
-rw-r--r-- | test/files/neg/t5504/s_1.scala | 4 | ||||
-rw-r--r-- | test/files/neg/t5504/s_2.scala | 8 | ||||
-rw-r--r-- | test/files/neg/t591.check | 3 | ||||
-rw-r--r-- | test/files/neg/t800.check | 9 |
15 files changed, 39 insertions, 17 deletions
diff --git a/test/files/neg/macro-invalidsig-context-bounds.check b/test/files/neg/macro-invalidsig-context-bounds.check index dd68e5db1b..a37b891df6 100644 --- a/test/files/neg/macro-invalidsig-context-bounds.check +++ b/test/files/neg/macro-invalidsig-context-bounds.check @@ -1,4 +1,2 @@ -Impls_1.scala:4: error: macro implementations cannot have implicit parameters other than TypeTag evidences
- def foo[U: c.TypeTag: Numeric](c: Ctx) = {
- ^
-one error found
+error: macro implementations cannot have implicit parameters other than TypeTag evidences +one error found diff --git a/test/files/neg/macro-invalidsig-context-bounds/Macros_Test_2.scala b/test/files/neg/macro-invalidsig-context-bounds/Macros_Test_1.scala index 5b4602f328..5b4602f328 100644 --- a/test/files/neg/macro-invalidsig-context-bounds/Macros_Test_2.scala +++ b/test/files/neg/macro-invalidsig-context-bounds/Macros_Test_1.scala diff --git a/test/files/neg/overloaded-unapply.check b/test/files/neg/overloaded-unapply.check index 1da93f6939..68a826bac2 100644 --- a/test/files/neg/overloaded-unapply.check +++ b/test/files/neg/overloaded-unapply.check @@ -7,7 +7,8 @@ match argument types (List[a]) overloaded-unapply.scala:22: error: cannot resolve overloaded unapply case List(x, xs) => 7 ^ -overloaded-unapply.scala:12: error: method unapply is defined twice in overloaded-unapply.scala +overloaded-unapply.scala:12: error: method unapply is defined twice + conflicting symbols both originated in file 'overloaded-unapply.scala' def unapply[a](xs: List[a]): Option[Null] = xs match { ^ three errors found diff --git a/test/files/neg/primitive-sigs-1.check b/test/files/neg/primitive-sigs-1.check index 8713d95cc3..77dc457a49 100644 --- a/test/files/neg/primitive-sigs-1.check +++ b/test/files/neg/primitive-sigs-1.check @@ -1,6 +1,6 @@ -A_3.scala:3: error: type mismatch; +B.scala:3: error: type mismatch; found : Bippy required: AC[Integer] - J_2.f(new Bippy()) - ^ + J.f(new Bippy()) + ^ one error found diff --git a/test/files/neg/primitive-sigs-1/A_1.scala b/test/files/neg/primitive-sigs-1/A.scala index 0dd83b5d6a..0dd83b5d6a 100644 --- a/test/files/neg/primitive-sigs-1/A_1.scala +++ b/test/files/neg/primitive-sigs-1/A.scala diff --git a/test/files/neg/primitive-sigs-1/A_3.scala b/test/files/neg/primitive-sigs-1/B.scala index dec617a111..0958bcda57 100644 --- a/test/files/neg/primitive-sigs-1/A_3.scala +++ b/test/files/neg/primitive-sigs-1/B.scala @@ -1,5 +1,5 @@ object Test { def main(args: Array[String]): Unit = { - J_2.f(new Bippy()) + J.f(new Bippy()) } } diff --git a/test/files/neg/primitive-sigs-1/J_2.java b/test/files/neg/primitive-sigs-1/J.java index b416befb4d..2e43b8330c 100644 --- a/test/files/neg/primitive-sigs-1/J_2.java +++ b/test/files/neg/primitive-sigs-1/J.java @@ -1,6 +1,6 @@ // java: often the java or scala compiler will save us from // the untruth in the signature, but not always. -public class J_2 { +public class J { public static Integer f(AC<Integer> x) { return x.f(); } public static void main(String[] args) { f(new Bippy()); diff --git a/test/files/neg/t200.check b/test/files/neg/t200.check index 3ef6665fe5..b6b1a32267 100644 --- a/test/files/neg/t200.check +++ b/test/files/neg/t200.check @@ -1,4 +1,5 @@ -t200.scala:7: error: method foo is defined twice in t200.scala +t200.scala:7: error: method foo is defined twice + conflicting symbols both originated in file 't200.scala' def foo: Int; ^ one error found diff --git a/test/files/neg/t2779.check b/test/files/neg/t2779.check index d642541e3e..0ab4c50d0f 100644 --- a/test/files/neg/t2779.check +++ b/test/files/neg/t2779.check @@ -1,4 +1,5 @@ -t2779.scala:16: error: method f is defined twice in t2779.scala +t2779.scala:16: error: method f is defined twice + conflicting symbols both originated in file 't2779.scala' override def f = List(M1) ^ one error found diff --git a/test/files/neg/t278.check b/test/files/neg/t278.check index 0c2dfeb67a..405f7d225c 100644 --- a/test/files/neg/t278.check +++ b/test/files/neg/t278.check @@ -4,7 +4,8 @@ t278.scala:5: error: overloaded method value a with alternatives: does not take type parameters println(a[A]) ^ -t278.scala:4: error: method a is defined twice in t278.scala +t278.scala:4: error: method a is defined twice + conflicting symbols both originated in file 't278.scala' def a = (p:A) => () ^ two errors found diff --git a/test/files/neg/t5504.check b/test/files/neg/t5504.check new file mode 100644 index 0000000000..2827c02d10 --- /dev/null +++ b/test/files/neg/t5504.check @@ -0,0 +1,4 @@ +error: type _$1 is defined twice + conflicting symbols both originated in file 't5504/s_1.scala' + Note: this may be due to a bug in the compiler involving wildcards in package objects +one error found diff --git a/test/files/neg/t5504/s_1.scala b/test/files/neg/t5504/s_1.scala new file mode 100644 index 0000000000..35cb2c8bae --- /dev/null +++ b/test/files/neg/t5504/s_1.scala @@ -0,0 +1,4 @@ +// a.scala +package object foo { + val m: List[_] = Nil +} diff --git a/test/files/neg/t5504/s_2.scala b/test/files/neg/t5504/s_2.scala new file mode 100644 index 0000000000..03eecf6e19 --- /dev/null +++ b/test/files/neg/t5504/s_2.scala @@ -0,0 +1,8 @@ +// b.scala +package foo + +object Test { + def main(args: Array[String]): Unit = { + println(foo.m) + } +} diff --git a/test/files/neg/t591.check b/test/files/neg/t591.check index 5cdeebf079..d33f6d7a2f 100644 --- a/test/files/neg/t591.check +++ b/test/files/neg/t591.check @@ -1,4 +1,5 @@ -t591.scala:38: error: method input_= is defined twice in t591.scala +t591.scala:38: error: method input_= is defined twice + conflicting symbols both originated in file 't591.scala' def input_=(in : Input) = {} ^ one error found diff --git a/test/files/neg/t800.check b/test/files/neg/t800.check index 44c316a95b..8ba95fddde 100644 --- a/test/files/neg/t800.check +++ b/test/files/neg/t800.check @@ -1,13 +1,16 @@ t800.scala:4: error: qualification is already defined as value qualification val qualification = false; ^ -t800.scala:8: error: method qualification is defined twice in t800.scala +t800.scala:8: error: method qualification is defined twice + conflicting symbols both originated in file 't800.scala' val qualification = false; ^ -t800.scala:12: error: value qualification is defined twice in t800.scala +t800.scala:12: error: value qualification is defined twice + conflicting symbols both originated in file 't800.scala' var qualification = false; ^ -t800.scala:16: error: method qualification is defined twice in t800.scala +t800.scala:16: error: method qualification is defined twice + conflicting symbols both originated in file 't800.scala' var qualification = false; ^ four errors found |