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/primitive-sigs-1 | |
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/primitive-sigs-1')
-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 |
3 files changed, 2 insertions, 2 deletions
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()); |