summaryrefslogtreecommitdiff
path: root/src/compiler
Commit message (Collapse)AuthorAgeFilesLines
*---. Merge remote-tracking branches 'gkossakowski/virtpatmat-switch', ↵Paul Phillips2012-02-013-13/+63
|\ \ \ | | | | | | | | | | | | 'scalamacros/pullrequest/5427' and 'scalamacros/pullrequest/5423' into develop
| | | * Introduce getAnnotations that triggers symbol completionEugene Burmako2012-01-311-0/+10
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Default getter for annotations doesn't perform initialization, hence we've faced the following bug: https://issues.scala-lang.org/browse/SI-5423. One of the approaches to fixing it would be to auto-complete on getter, but according to Martin we'd better not do that because of cycles. That's why I'm just introducing a new, eager, variation of `annotations' and redirecting public API to it. Review by @odersky.
| * | Convert values to Int in switchable patterns.Grzegorz Kossakowski2012-02-011-21/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Further improvements to how -Yvirtpatmat handles switch-like patterns that can be translated to switch tables. First of all, we added a check whether a type of an expression we pattern match on is in the set of allowed types for switch patterns. If yes, we translate a pattern to switch one by converting both an expression we pattern match on and literals in a pattern to an Int. I borrowed an idea of converting to Ints from both old pattern matcher implementation and from how javac handles it.
| * | Generate default case for switches.Grzegorz Kossakowski2012-02-011-1/+12
| | |
| * | Get rid of unused import.Grzegorz Kossakowski2012-02-011-1/+1
| | |
| * | Unfold pattern alternatives in genicode.Grzegorz Kossakowski2012-02-011-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implemented unfolding of pattern alternatives that can be translated into switch table in genicode. This way pattern matcher can keep simple patterns as-is and let backend handle translation of them instead of generating bunch of LabelDefs and jumps. Review by @dragos or @magarciaEPFL as both seem to know genicode very well.
* | | Added getPackage to the repl classloader.Paul Phillips2012-02-012-0/+30
| | |
* | | Tweak to repl debugging output.Paul Phillips2012-02-011-1/+1
|/ /
* / Improved warning for insensible comparisons.Paul Phillips2012-01-311-4/+7
|/ | | | | Utilize knowledge of case class synthetic equals to rule out some comparisons statically. Closes SI-5426.
* Print compound types legibly.Paul Phillips2012-01-302-19/+35
| | | | | | | | | This one's about a million years overdue. Try this on for size, from the command line: printf ":power\nList(1).?.baseClasses.sigs >\n" | scala Also, a little more power mode refinement.
* Merge branch 'develop'Paul Phillips2012-01-301-1/+1
|\
| * Closes #4336.Hubert Plociniczak2012-01-301-1/+1
| | | | | | | | Some of the type params might already be instantiated if explicit type application is done. Review by @adriaanm
* | A couple power mod conveniences.Paul Phillips2012-01-302-56/+91
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And disambiguations. And renamed all kinds of methods to something less inscrutable. Moved all the instance-to-compiler-structure implicit behind a wrapper to avoid accidental conversions. The wrapper has a single method, ?, which you can experience like so: // Sorry tab completion doesn't yet figure out implicit conversions scala> val x = Map(1 -> 2).? x: $r.power.InternalInfo[scala.collection.immutable.Map[Int,Int]] = Map(1 -> 2) (Map) scala> x. asInstanceOf baseTypeSeq baseTypeSeqMap baseTypeWhichDefines companion decls declsOriginal declsOverride erasure fullManifest glb info isInstanceOf lub memberMethods memberTypes members membersDeclared membersInherited membersUnabridged moduleClass name owner owners pkg pkgClass pkgClassSymbols pkgClasses pkgMembers pkgName pkgSymbols shortClass signature symbol toString tpe // This uses an implicit to install sigs (and another for '>' which is // the generic printing function) but transparency, one step at a time. scala> Map(1 -> 2).?.membersDeclared.sigs > def $init$(): Unit override def empty: scala.collection.immutable.Map[A,B] override def toMap[T,U](implicit ev: <:<[(A, B),(T, U)]): scala.collection.immutable.Map[T,U] override def seq: scala.collection.immutable.Map[A,B] def withDefault[B1 >: B](d: A => B1): scala.collection.immutable.Map[A,B1] def withDefaultValue[B1 >: B](d: B1): scala.collection.immutable.Map[A,B1] override def updated[B1 >: B](key: A,value: B1): scala.collection.immutable.Map[A,B1] def +[B1 >: B](kv: (A, B1)): scala.collection.immutable.Map[A,B1]
*-. Merge remote-tracking branches 'scalamacros/topic/yshowsymkinds' and ↵Paul Phillips2012-01-297-39/+78
|\ \ | | | | | | | | | 'scalamacros/ticket/5418' into develop
| * | -Yshow-symkinds: prints kinds next to symbol namesEugene Burmako2012-01-287-39/+78
| |/ | | | | | | | | | | | | | | | | This very situational option proved to be very useful when debugging https://issues.scala-lang.org/browse/SI-5415 With the help of -Yshow-symkinds, it became possible to distinguish a free var from a module symbol, which gave precise indication of the root of the bug.
* | More method synthesis unification.Paul Phillips2012-01-286-171/+182
| |
* | Cleaned up polymorphic method creation.Paul Phillips2012-01-283-67/+54
| | | | | | | | | | I love the smell of polymorphic method synthesis in the early afternoon.
* | Make 'illegal' characters less annoying.Paul Phillips2012-01-271-1/+1
| | | | | | | | At least tell us what they are.
* | Revert "-Yshow-symkinds: prints kinds next to symbol names"Paul Phillips2012-01-277-77/+39
| | | | | | | | This reverts commit 6a5901461c1aaac7dd8786cb374b079520895527.
| |
| \
*-. | Merge remote-tracking branches 'scalamacros/topic/yshowsymkinds' and ↵Paul Phillips2012-01-277-39/+77
|\ \| | | | | | | | | | 'axel22/feature/immutable-thread-safe' into develop
| * | -Yshow-symkinds: prints kinds next to symbol namesEugene Burmako2012-01-277-39/+77
| |/ | | | | | | | | | | | | | | | | | | | | | | This very situational option proved to be very useful when debugging https://issues.scala-lang.org/browse/SI-5415 With the help of -Yshow-symkinds, it became possible to distinguish a free var from a module symbol, which gave precise indication of the root of the bug. This changeset also upgrades stringification of symbols and types, so I'd like to get a review by @paulp and @odersky.
* | Disabled "not found" suggestions.Paul Phillips2012-01-261-0/+4
| | | | | | | | | | The benchmarks charts are confusing me and I want to rule it out as a problem by not having it exist for a while.
* | Intercept assert and require calls.Paul Phillips2012-01-2621-74/+143
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-262-3/+14
|/ | | | | | "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-2539-398/+811
|\ | | | | | | | | | | | | | | 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
| * Tightening of constructors in Symbols, to force everyone to use the factory ↵Martin Odersky2012-01-251-10/+10
| | | | | | | | methods that take account of synchronization when run under reflection.
| * More work on making reflection thread-safe.Martin Odersky2012-01-257-25/+33
| |
| * Protecting the constructors of Scopes and Symbols so that everyone is forced ↵Martin Odersky2012-01-252-3/+11
| | | | | | | | to go through the factory method, which adds on synchronization when run under reflection.
| * Making Definitions thread-safe by replacing a bunch of vars with lazy vals.Martin Odersky2012-01-251-58/+53
| |
| * Making reflection thread-safe.Martin Odersky2012-01-2534-308/+700
| | | | | | | | 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.
| |
| \
| \
| \
*---. \ Merge remote-tracking branches 'hubertp/topic/errors', ↵Paul Phillips2012-01-251-1/+2
|\ \ \ \ | | | | | | | | | | | | | | | 'scalamacros/topic/antbuildexception', 'leifwickland/SI-5405' and 'axel22/issue/5377' into develop
| * | | | Scalac fork no longer dumps stacktraces on compilation errorsEugene Burmako2012-01-251-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current behavior of scalacfork task is to fail the build when there are compilation errors reported by scalac fork. So far, so good. However, this functionality is implemented by throwing sys.error, which makes ant dump the entire stacktrace. This is annoying, since it almost certainly scrolls the screen away of the error (hello, dear 1366x768) and buries it under a meaningless stacktrace. Surprisingly, there is a very simple fix that remedies the situation. Credit goes to @bakoyaro from SO: http://bit.ly/xdR306
* | | | | Use context for buffering errors that cannot/shouldn't be reported in the ↵Hubert Plociniczak2012-01-2524-1164/+2118
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | given moment (instead of throwing type errors). This avoids previous problems where we were creating fake error trees in some incorrect places like in type completers in Namers etc. Implicits relied heavily on type errors being thrown but performance should stay the same due to some explicit checks/returns. Some of the problems involved how ambiguous error messages were collected/reported because it was very random (similarly for divergent implicits). This should be more explicit now. Reduced the number of unnecessary cyclic references being thrown (apart from those in Symbols/Types which don't have a context and need to stay for now as is). Review by @paulp, @odersky.
* | | | Renamed a method and made it more available.Paul Phillips2012-01-242-13/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have too many methods called "widen" and/or "normalize". Renamed one of them to something more instructive. Or in the words of abe simpson, Dear Mr. President: There are too many states nowadays. Please eliminate three. P.S. I am not a crackpot.
* | | | Eliminated redundant function.Paul Phillips2012-01-241-9/+1
| | | |
* | | | Got out in front of catastrophic failure.Paul Phillips2012-01-241-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | Should be better than "typeConstructor inapplicable for <none>" being the default message communicating "something is wrong with your attempt to use a compiler programatically."
* | | | Created NoAbstractFile.Paul Phillips2012-01-242-1/+33
| | | | | | | | | | | | | | | | | | | | A very distinguished value in case one feels (as this one does) that null is disheartening and Option only marginally better.
* | | | Moved some code.Paul Phillips2012-01-242-14/+24
|/ / / | | | | | | | | | From ConsoleReporter to Position so others can use it.
* / / Simplified emitSwitch in PatMatVirtualiser.Grzegorz Kossakowski2012-01-241-41/+27
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | Simplified emitSwitch method that does not emit forward jumps for switch tables. Instead, it emits Match trees that are of a shape that can be directly translated to switch. The backend takes care of the actual translation from Match trees into switch tables. As a bonus, we emit more compact trees compared to the old implementation of emitSwitch. Review by @adriaanm.
* | Figured out the "$class$1" problem.Paul Phillips2012-01-235-56/+105
| | | | | | | | | | | | | | 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-234-10/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| |
| \
*-. \ Merge remote-tracking branches 'scalamacros/topic/partest' and ↵Paul Phillips2012-01-221-49/+73
|\ \ \ | | | | | | | | | | | | 'magarciaEPFL/fasterInliner' into develop
| | * | increased realiabilityMiguel Garcia2012-01-221-3/+6
| | | |
| | * | fix to avoid loading what shouldn't be loadedMiguel Garcia2012-01-201-5/+4
| | | |
| | * | further reduction in inlining time. This time, 40%Miguel Garcia2012-01-201-48/+70
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | Two main improvements: (a) an IClass is loaded via ICodeReader at most once. (b) given that type-flow analysis results don't change for "external" methods (those loaded via ICodeReader), we can cache them. The same inlining decisions are made as before, see -Ylog:inliner, with a focus on lines starting with "[log inliner] Inlining" review by @VladUreche @dragos @paulp
* | | Made typeConstructor applicable for some.Paul Phillips2012-01-211-1/+5
| | | | | | | | | | | | | | | | | | | | | Or at least made the error message applicable for some. NSDNHO too. It almost feels like sacrilege to mess with "no-symbol does not have owner", even to the extent of adding the indefinite article. May Zeus not strike me down.
* | | Merge remote-tracking branches 'retronym/ticket/5072' and ↵Paul Phillips2012-01-212-2/+17
|\ \ \ | | | | | | | | | | | | 'odersky/topic/t5120' into develop
| * | | Fix for problem in SBT that was caused by the too severe fix of type ↵Martin Odersky2012-01-212-2/+17
| | |/ | |/| | | | | | | soundness problem t5120.
* | | A better REPL context classloader.Jason Zaugg2012-01-212-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, when using ThreadStoppingLineManager (ie, not using -Yrepl-sync), the parent classloader was installed as the thread context classloader. On my machine, this was null. Now, the behaviour is consistent with the thread-free line manager, and allows access to classes defined during the REPL session. Closes SI-5072
| | |
| \ \
*-. | | Merge remote-tracking branches 'cvogt/windowsExitCodeFix' and ↵Paul Phillips2012-01-201-1/+3
|\ \| | | |_|/ |/| | | | | 'szabolcsberecz/SI-5066' into develop