From 0fb12fa0620c5f9999e309a4de7831549b283c24 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Fri, 4 May 2012 17:44:28 -0700 Subject: 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 ")) } --- test/files/neg/t2779.check | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/files/neg/t2779.check') 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 -- cgit v1.2.3