summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
Commit message (Collapse)AuthorAgeFilesLines
...
| * Some logging cleanup.Paul Phillips2012-02-261-1/+3
| | | | | | | | | | Quieting things down. Fixed some things revealed by quieter logs, like forwarders being generated for superaccessors.
| * Toward a higher level abstraction than atPhase.Paul Phillips2012-02-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I guess these are self-explanatory. @inline final def afterErasure[T](op: => T): T = afterPhase(currentRun.erasurePhase)(op) @inline final def afterExplicitOuter[T](op: => T): T = afterPhase(currentRun.explicitouterPhase)(op) ... @inline final def beforeTyper[T](op: => T): T = beforePhase(currentRun.typerPhase)(op) @inline final def beforeUncurry[T](op: => T): T = beforePhase(currentRun.uncurryPhase)(op) This commit is basically pure substitution. To get anywhere interesting with all the phase-related bugs we have to determine why we use atPhase and capture that reasoning directly. With the exception of erasure, most phases don't have much meaning outside of the compiler. How can anyone know why a block of code which says atPhase(explicitouter.prev) { ... } needs to run there? Too much cargo cult, and it should stop. Every usage of atPhase should be commented as to intention. It's easy to find bugs like atPhase(uncurryPhase.prev) which was probably intended to run before uncurry, but actually runs before whatever happens to be before uncurry - which, luckily enough, is non-deterministic because the continuations plugin inserts phases between refchecks and uncurry. % scalac -Xplugin-disable:continuations -Xshow-phases refchecks 7 reference/override checking, translate nested objects uncurry 8 uncurry, translate function values to anonymous classes % scalac -Xshow-phases selectivecps 9 uncurry 10 uncurry, translate function values to anonymous classes Expressions like atPhase(somePhase.prev) are never right or are at best highly suboptimal, because most of the time you have no guarantees about what phase precedes you. Anyway, I think most or all atPhases expressed that way only wanted to run before somePhase, and because one can never be too sure without searching for documentation whether "atPhase" means before or after, people err on the side of caution and overshoot by a phase. Unfortunately, this usually works. (I prefer bugs which never work.)
| * One more to derive trees.Paul Phillips2012-02-231-2/+2
| | | | | | | | | | | | ClassDefs, CaseDefs, and LabelDefs. Dotting eyes, crossing tees. Point of diminishing returns is reached, declare victory and withdraw.
| * Methods to derive new DefDefs.Paul Phillips2012-02-231-4/+2
| | | | | | | | | | | | | | | | | | | | | | I guess I'd seen DefDef(mods, name, tparams, vparamss, tpt, rhs) one too many times and went a little crazy. What do you prefer: - val DefDef(mods, name, tparams, vparamss, tpt, rhs) = tree1 - treeCopy.DefDef(tree1, mods, name, tparams, vparamss, tpt, transform(rhs)) + deriveDefDef(tree1)(transform) Me too.
| * Fix for SI-5444.Paul Phillips2012-02-131-3/+2
| | | | | | | | | | Fix for trait/impl renaming in 5cbd7d06eb was incomplete. Looks more complete now.
* | Hardened/documented AnyVal constructor switcheroo.Paul Phillips2012-02-041-0/+1
| |
* | Fixing AnyVal verify error and reflection.Paul Phillips2012-02-041-2/+7
| | | | | | | | | | | | | | | | Have to give AnyVal a constructor and simultaneously pacify both the typer (which knows Any has no constructor) and the jvm (which mandates a constructor must call its superconstructor.) It's the usual angle of adding a not-quite-right tree during parsing and then finishing it later (in this case, in AddInterfaces.)
* | Making AnyVal into a class instead of a trait.Paul Phillips2012-02-041-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -- traits can extend Any, AnyRef, or AnyVal -- classes can extend AnyRef or AnyVal but not Any. This breaks reflection for the moment as it smuggles AnyVal so far downstream that it's reflecting its way into bytecode (or something) but the following test case goes five for six as anticipated. trait Foo1 extends Any trait Foo2 extends AnyVal trait Foo3 extends AnyRef class Bar1 extends Any // fail @inline class Bar2 extends AnyVal class Bar3 extends AnyRef Eliminated various hijinx from definitions.
* | Mostly eliminated ScalaObject.Paul Phillips2012-02-031-1/+1
|/
* Intercept assert and require calls.Paul Phillips2012-01-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | And abort calls, and unhandled exceptions, all so I can supplement the error message with a little of the vast quantity of useful information which we possess but do not reveal. "Details are sketchy," says the officer tasked with investigating the crash, but no longer. Also took the opportunity to eliminate a bunch of one-argument assertions and requirements if I thought there was any chance I'd someday be facing them on the wrong end of an incident. Have you ever dreamed that instead of this experience: % scalac -optimise <long list of files> error: java.lang.AssertionError: assertion failed: Record Record(anonymous class JavaToScala$$anonfun$makeScalaPackage$1,Map()) does not contain a field value owner$1 Things could proceed more like this: % scalac -optimise <long list of files> error: while compiling: src/compiler/scala/reflect/runtime/JavaToScala.scala current phase: closelim library version: version 2.10.0.rdev-4267-2012-01-25-gc94d342 compiler version: version 2.10.0.rdev-4270-2012-01-26-gd540ddf reconstructed args: -Ydead-code -optimise -Yinline -Yclosure-elim -Yinline-handlers -d /tmp error: java.lang.AssertionError: [etc] You are not dreaming! IT'S ALL HAPPENING
* Fix for recently induced -optimise crasher.Paul Phillips2012-01-261-2/+8
| | | | | | "Induced" but not in my estimation "caused". Would like to understand why the enclosed test case crashes under -optimise without this change to AddInterfaces.
* Merge remote-tracking branch 'odersky/topic/reflect' into developPaul Phillips2012-01-251-1/+1
|\ | | | | | | | | | | | | | | Conflicts: src/compiler/scala/reflect/internal/Symbols.scala src/compiler/scala/reflect/internal/Types.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala src/library/scala/reflect/api/Trees.scala
| * Making reflection thread-safe.Martin Odersky2012-01-251-1/+1
| | | | | | | | The idea is that all operations that need to be synchronized are overriden in classes reflect.runtime.Synchronized*. Sometimes this applies to operations defined in SymbolTable, which can be directly overridden. Sometimes it is more convenient to generate SynchronizedClazz subclasses of SymbolTable classes Clazz. In the latter case, all instance creation must go over factory methods that can be overridden in the Synchronized traits.
* | Figured out the "$class$1" problem.Paul Phillips2012-01-231-30/+43
| | | | | | | | | | | | | | In lambda lift traits are renamed independently of their implementation classes, leading in the case of a method-defined trait to an interface called A$1 and an impl class called A$class$1 rather than A$1$class. This is now remedied.
* | Linked up $class visibility to symbol redefinition.Paul Phillips2012-01-231-4/+11
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In what feels like divine intervention as I spent my entire day yesterday unsuccessfully attempting to understand why running atop my new classpath code, trunk would compile and then fail like this: build.xml:1683: Could not create type partest due to java.lang.NoSuchMethodError: scala.tools.ant.sabbus.CompilationPathProperty$class.$init$(Lscala/tools/ant/sabbus/CompilationPathProperty;)V I discovered the link by trying to debug a seemingly completely unrelated problem reported by pvlugter. On the one hand you have PathResolver/ClassPath, which by default does not place trait implementation classes on the compilation classpath, but does do so under -optimise (as I understand it, this is so inlining can be performed, so let us ignore the fact that methods in traits are never inlined, as outlined in SI-4767.) object DefaultJavaContext extends JavaContext { override def isValidName(name: String) = !isTraitImplementation(name) } Then on the other hand you have this logic in AddInterfaces: if (impl != NoSymbol && settings.optimise.value) { log("unlinking impl class " + impl) ... } The test in AddInterfaces is hardcoded to only consider the value of -optimise. Which means that in the completely default -optimise setup, it corresponds to the answers given by "isValidName" in JavaContext, but nothing keeps those elements in sync. The connection to my lost day was that, thinking I was "simplifying" my development, I had commented out the override in DefaultJavaContext so that all classes were on the compilation path. This caused the state of settings.optimise (still false) and whether impl classes were on the classpath (now true) to fall into fatal disagreement.
* Symbol creation followup.Paul Phillips2012-01-161-2/+5
| | | | | | Changed most symbol creations to be consistent with all the others. Opportunistically streamlined various call sites. Moved some phase-specific methods out of Symbol to somewhere more appropriate (like that phase.)
* Putting some of the symbol potential to work.Paul Phillips2012-01-141-2/+2
| | | | | | | | Renamed the parameter to all the newXXX symbol creators to "newFlags" because I've seen too many bugs which arose from having a parameter name which shadows a field and where mistakes can inflict subtle bugs which won't be found until much later (yes I'm trying to describe "flags" right now.) Opportunistically cleaned up some symbol creations.
* Optimizations in typeref creation.Paul Phillips2011-12-301-2/+2
| | | | | | A couple locations where more work than necessary is performed when created a typeref. (Not to mention creating bogus typerefs applying arguments to implementation classes.)
* Another problem solved for reflexive compiler.Martin Odersky2011-09-071-1/+2
|
* Cleanups in Namers and AddInterfaces emerging f...Paul Phillips2011-08-041-57/+41
| | | | | | | | Cleanups in Namers and AddInterfaces emerging from bugfixing attempts and comprehension pursuits. I appear to have accidentally fixed at least one bug, as there are new (correct) warnings when building the compiler involving permanently hidden imports. No review.
* LiftCode works again, now integrated with new r...Martin Odersky2011-07-301-1/+1
| | | | | | | | LiftCode works again, now integrated with new reflection library. Other changes: def Literal(x: Any) has been deprecated, and all its uses removed. Modifiers has lost positions as fourth case class argument; is now a field, mirroring Tree.pos (this removes junk in patterns and makes reification simpler). Review by extempore.
* Sprinkled some quiet dust on the compiler.Paul Phillips2011-07-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | I think it a reasonable goal that one should be able to do the following and have some chance of seeing anomalies before firing up advanced text processing tools: scalac -Ylog:all a.scala At least until/unless we have some way of generating output in between "user-level visible warnings" and "notice of interest once you're peeking under the hood." As a rule of thumb, any code which echoes a thousand lines when compiling HelloWorld should be gently shoved into debuglog. (Or anything which is sure to print for every classfile, every method, etc. etc.) Especially, any code which is going to simply reference Tuple2 and then echo a line for every specialized variation of that class is being unreasonably taxed. While I was quietizing, I changed various 'if (settings.debug.value) log' usages to call debuglog. Hey everyone, you can do this without penalty now, the inliner turns around and inlines the same code, and it's so much less unsightly. No review.
* Modified erasure so we have enough information ...Paul Phillips2011-07-181-26/+19
| | | | | | | | | | | | Modified erasure so we have enough information to determine whether we need to use scala or java erasure semantics. This fixes the runtime failure illustrated here: % scala29 -e 'java.util.Collections.max(null)' java.lang.NoSuchMethodError: java.util.Collections.max(Ljava/util/Collection;)Ljava/lang/Comparable; Review by odersky.
* Adding some Sets/Maps to perRunCaches, and elim...Paul Phillips2011-07-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Adding some Sets/Maps to perRunCaches, and eliminating ambiguously named imports. Did a tour of the compiler adding a few longer-lived mutable structures to the per-run cache clearing mechanism. Some of these were not a big threat, but there is (almost) literally no cost to tracking them and the fewer mutable structures which are created "lone wolf style" the easier it is to spot the one playing by his own rules. While I was at it I followed through on long held ambition to eliminate the importing of highly ambiguous names like "Map" and "HashSet" from the mutable and immutable packages. I didn't quite manage elimination but it's pretty close. Something potentially as pernicious which I didn't do much about is this import: import scala.collection._ Imagine coming across that one on lines 407 and 474 of a 1271 file. That's not cool. Some poor future programmer will be on line 1100 and use "Map[A, B]" in some function and only after the product has shipped will it be discovered that the signature is wrong and the rocket will now be crashing into the mountainside straightaway. No review.
* Fixes #4490 and #4467.Kato Kazuyoshi2011-06-181-2/+2
|
* Since I don't want to commit anything "interest...Paul Phillips2011-05-011-2/+2
| | | | | | | | Since I don't want to commit anything "interesting" until we ship 2.9, a few uninteresting cleanups involving how types are printed, getting some debugging code in shape to prepare for the long winter ahead, etc. No review.
* Don't issue a deprecation warning if the deprec...Paul Phillips2011-05-011-2/+2
| | | | | | Don't issue a deprecation warning if the deprecated method is being called from a bridge method. No review.
* Refined handling fo @bridge methods.Martin Odersky2011-04-241-2/+6
|
* Updated copyright notices to 2011Antonio Cunei2011-01-201-1/+1
|
* Starting the mopping up now that names have som...Paul Phillips2010-12-031-26/+24
| | | | | | | | | | | | | | Starting the mopping up now that names have some more sense of their place in the universe. Cleaned up some heavy multi-boolean logic. Added more documentation on the relationships between entities in Symbols and some other compiler things which often blur together. Fun fact: the incorrect usage of nme.ScalaObject in Contexts which I reported when first broaching the namespace subject became a compile time error during the writing of this patch, because there is no longer any such thing as nme.ScalaObject. It's a little bit like magic. No review.
* It's a big one!Paul Phillips2010-12-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TermName and TypeName are exposed throughout the compiler based on what kind of name a given abstraction ought to have. (There remain places where one needs to create a name without knowing yet what it will be, and those will always be Names.) The nme object in the compiler now holds only term names. To reference a known type name, use tpnme: nme.List == ("List": TermName) tpnme.List == ("List": TypeName) The contents of nme and tpname are defined in traits, many of which are shared, so if a name should exist only as a Type and not a Term, it should be defined in CompilerTypeNames, but otherwise in CompilerTermNames or CompilerCommonNames. This is partially complete but I'm sure there are still many shared which should pick a side. Usage of .toTermName and .toTypeName is strongly discouraged. After the dust has settled, there will be very few places where it will make sense to hop between namespaces like that. There are some implicits to smooth everything out, most of which should be removable eventually. // these two are in no hurry to go anywhere String => TermName String => TypeName // but not String => Name: def view in the compiler is no longer implicit // these two are temporary, and can log when they kick off to help us flush // out remaining issues of "name migration" Name => TermName Name => TypeName There is more work to be done before we're properly protected from naming errors, but I will not allow another eight hour tragedy to befall lukas or anyone else! Review by rytz. (Formality.)
* One of those annoying patches for which I apolo...Paul Phillips2010-11-021-20/+13
| | | | | | | | | | One of those annoying patches for which I apologize in advance. It's a step toward a better world. Almost all the changes herein are simple transformations of "x hasFlag FOO" to "x.isFoo", with the remainder minor cleanups. It's too big to review, so let's say no review: but I'm still all ears for input on the issues mostly outlined in HasFlags.scala.
* Some cleanups in the compiler source.Paul Phillips2010-10-111-3/+4
| | | | | | | eliminated the import of ambiguously named classes from e.g. collection.mutable, obeyed a todo in the parser regarding dropping lbracket from statement starting tokens. No review.
* Closes #3417. No review (already done by Martin)Hubert Plociniczak2010-05-181-1/+2
|
* Removed more than 3400 svn '$Id' keywords and r...Antonio Cunei2010-05-121-1/+0
| | | | | Removed more than 3400 svn '$Id' keywords and related junk.
* As a brief diversion from real work, implemente...Paul Phillips2010-04-061-1/+1
| | | | | | | | | As a brief diversion from real work, implemented Damerau–Levenshtein and ran it on trunk to elicit obvious misspellings. Unfortunately they're mostly in places like compiler comments which real people never see, but I fixed them anyway. All those English Lit majors who peruse our sources are sure to be pleased. No review.
* do not set the type of the implementation metho...Hubert Plociniczak2010-03-121-1/+1
| | | | | | | do not set the type of the implementation method to be the type of the original one as this is done properly in cloneSymbol. no review (already done by Martin)
* A few yards short of the goal posts attempt at ...Paul Phillips2010-03-041-1/+1
| | | | | | | | | | | A few yards short of the goal posts attempt at making our usage of Throwable subclasses more consistent. This patch eliminates a lot of ad hoc Exception/Error/etc. creation and various arbitrary choices are rendered slightly less arbitrary. From now on let's try not to use the word "Exception" or "Error" in the names of Throwable subclasses unless they actually derive (and make sense to derive) from Exception or Error. Review by community.
* Updated copyright notices to 2010Antonio Cunei2009-12-071-1/+1
|
* new classpaths.Lukas Rytz2009-10-261-1/+1
|
* Fixed #2317.Iulian Dragos2009-09-041-0/+5
|
* switch to unnested packages.Martin Odersky2009-07-241-1/+2
|
* Trying to make typechecker faster by (1) new su...Martin Odersky2009-07-131-1/+1
| | | | | | | Trying to make typechecker faster by (1) new subtyping (2) better implicit caches. Disallowed '42 as a symbol. Added cache method to Mutable Maps. Better complietion in interactive.
* allow using named / default arguments in self- ...Lukas Rytz2009-06-151-1/+2
| | | | | | allow using named / default arguments in self- and super constructor calls. fixes #2050 and #2052.
* Named and default argumentsLukas Rytz2009-05-301-8/+8
| | | | | | | - MethodTypes now have (params: List[Symbol]) - "copy"-methods for case classes - the "copy" object in the compiler is now called "treeCopy"
* more work on rangepositions.Martin Odersky2009-05-281-1/+0
|
* In "Iterable" and in all its subclasses, "itera...Gilles Dubochet2009-05-271-1/+1
| | | | | | In "Iterable" and in all its subclasses, "iterator" replaces "elements" (and assorted changes).
* Make sure the symbol for the implementation cla...Miles Sabin2009-05-211-0/+1
| | | | | | Make sure the symbol for the implementation class of a trait has an associated source file.
* removed deprecated for-loopsmichelou2009-02-241-4/+4
|
* Updated (all) copyright notices to 2009Antonio Cunei2009-01-131-1/+1
|