summaryrefslogtreecommitdiff
path: root/test/files/run
Commit message (Collapse)AuthorAgeFilesLines
* [backport] SI-7470 implements fundep materializationEugene Burmako2014-07-0214-0/+130
| | | | | Backports 21a8c6c from the 2.11.x branch under -Xfundep-materialization as per Miles Sabin's request. Thanks Miles!
* Merge pull request #3655 from retronym/ticket/8442Grzegorz Kossakowski2014-03-265-0/+42
|\ | | | | SI-8442 Ignore stub annotation symbols in `AnnotationInfo#matches`
| * SI-8442 Ignore stub annotation symbols in `AnnotationInfo#matches`Jason Zaugg2014-03-255-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And update the java `ClassFileParser` to create distinguished `StubClassSymbol`s, rather that a regular `ClassSymbol`s, when encountering a deficient classpath. This brings it into line with `Unpickler`, which has done as much since a55788e275f. This stops the enclosed test case from crashing when determining if the absent symbol, `A_1`, is a subclass of `@deprecated`. This is ostensibly fixes a regression, although it only worked in `2.10.[0-3]` by a fluke: the class file parser's promiscious exception handling caught and recovered from the NPE introduced in SI-7439! % javac -d /tmp test/files/run/t8442/{A,B}_1.java && qbin/scalac -classpath /tmp -d /tmp test/files/run/t8442/C_2.scala && (rm /tmp/A_1.class; true) && scalac-hash v2.10.0 -classpath /tmp -d /tmp test/files/run/t8442/C_2.scala warning: Class A_1 not found - continuing with a stub. warning: Caught: java.lang.NullPointerException while parsing annotations in /tmp/B_1.class two warnings found
* | Merge pull request #3551 from xeno-by/topic/typecheck-member-defJason Zaugg2014-03-253-0/+32
|\ \ | | | | | | [nomaster] backports 609047ba37
| * | [nomaster] typecheck(q"class C") no longer crashesEugene Burmako2014-03-233-0/+32
| |/ | | | | | | | | | | | | | | | | | | | | MemberDefs alone can't be typechecked as is, because namer only names contents of PackageDefs, Templates and Blocks. And, if not named, a tree can't be typed. This commit solves this problem by wrapping typecheckees in a trivial block and then unwrapping the result when it returns back from the typechecker. (cherry picked from commit 609047ba372ceaf06916d3361954bc949a6906ee)
* | Merge pull request #3614 from retronym/ticket/8196Jason Zaugg2014-03-252-0/+54
|\ \ | | | | | | SI-8196 Runtime reflection robustness for STATIC impl details
| * | SI-8195 Test case to show this is a dup of SI-8196Jason Zaugg2014-03-111-2/+23
| | | | | | | | | | | | Which was fixed in the previous commit.
| * | SI-8196 Runtime reflection robustness for STATIC impl detailsJason Zaugg2014-03-112-0/+33
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Scala's runtime reflection works in few modes. The primary mode reads reads out the pickled signatures from ScalaSig annotations, if avaialable. However, these aren't available for Java-defined classes (obviously) nor for local Scala-defined classes (less obviously.), and the Scala `Symbol`s and `Types` must be reconstructed from the Java generic reflection metadata. This bug occurs in the last case, and is centered in `FromJavaClassCompleter`. In that completer, member fields and methods are given an owner based on the STATIC modifier. That makes sense for Java defined classes. I'm not 100% if it makes sense for Scala defined classes; maybe we should just skip them entirely? This patch still includes them, but makes the ownership-assignment more robust in the face of STATIC members emitted by the Scala compiler backend, such as the cache fields for structural calls. (It's reflection all the way down!). We might not have a companion module at all, so before we ended up owning those by `NoSymbol`, and before too long hit the dreaded NSDHNAO crash. That crash doesn't exist any more on 2.11 (it is demoted to a -Xdev warning), but this patch still makes sense on that branch. This commit makes `followStatic` and `enter` more robust when finding a suitable owner for static members. I've also factored out the duplicated logic between the two.
* / [backport] no longer warns on calls to vampire macrosEugene Burmako2014-03-054-0/+61
|/ | | | | | | | | | | | | As eloquently elaborated and cleverly named by Travis Brown, macros defined in structural types are useful: http://meta.plasm.us/posts/2013/07/12/vampire-methods-for-structural-types/. However, since such macros are on the intersection of a number of language features, as usual, there are bugs. This commit fixes an unwanted interaction of macros defined in structural types with the scala.language.reflectiveCalls guard. Since macro calls aren't going to be carried to runtime, there's no need to warn about them.
* [nomaster] SI-8114 Binary compat. workaround for erasure bug SI-7120Jason Zaugg2014-01-091-0/+15
| | | | | | | | | | | We can't backport SI-7120 to 2.10.x as it changes erased signatures, which can lead to interop problems between 2.10.3 and 2.10.4. But, we can detect one of the nasty symptoms -- a bridge method with the same signature as its target -- and treat that. This commit detects duplicate bridges in the ASM (only) backend and removes them.
* Report error on code size overflow, log method name.Adriaan Moors2013-12-122-0/+27
| | | | | | | We used to silently skip class files that would exceed the JVM's size limits. While rare, this should still be an error. While I was at it, also included the name of the offending method.
* SI-7912 Be defensive calling `toString` in `MatchError#getMessage`Jason Zaugg2013-12-101-0/+16
| | | | | Otherwise, objects with exception-throwing `toString` lead to a cascading error far removed from the originally failed match.
* Merge pull request #3229 from retronym/ticket/8029Adriaan Moors2013-12-091-0/+57
|\ | | | | SI-8029 Avoid multi-run cyclic error with companions, package object
| * SI-8029 Avoid multi-run cyclic error with companions, package objectJason Zaugg2013-12-061-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug report suggests this problem only became visible in the IDE *after* 2.10.3, but I tested an IDE with exactly 2.10.3 and saw the same problem. In fact, my test case fails as far back as 2.10.0. I suspect the problem showed up after 816cecf9a9, which checks that pairs of companion symbols are codefined eagerly in Namers. This commit modifies the check of `rawInfo ne NoType` in `isCoDefinedWith` to avoid triggering adaptation of types from the previous run. I'm not sure of the precise intent of that check. I looked at c9861cd198 (genesis of isCoDefinedWith). Before that we get back to 3761cb4b3a1 (the dawn of Subversion.)
* | Merge pull request #3230 from retronym/backport/7439Eugene Burmako2013-12-074-0/+38
|\ \ | | | | | | [backport] SI-7439 Avoid NPE in `isMonomorphicType` with stub symbols.
| * | [backport] SI-7439 Avoid NPE in `isMonomorphicType` with stub symbols.Jason Zaugg2013-12-074-0/+38
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `originalInfo` can return null for stub symbols; deal with that as we used to before a regression in 016bc3db. After this change, we can once again delete A_1.class and still compile code instantiating B_1. (A_1 is only referred to in a method signature of B_1 which is not called from our code.) scala> new B_1 warning: Class A_1 not found - continuing with a stub. res0: B_1 = B_1@5284b8f9 In practice, this situation arises when someone uses a third party class that was compiled against other libraries not avaialable on the current compilation classpath. (cherry picked from commit a95432168204964e4f6c4571e781559c1640f2d8)
* / SI-8010 Fix regression in erasure double definition checksJason Zaugg2013-12-061-0/+22
|/ | | | | | | | | | | | | | | | | | | | | | | Calls to `Symbol#info` during scope iteration considered harmful. Looks like calling `info` during this Scope iteration is triggering the ExplicitOuter info transformer, which "makes all super accessors and modules in traits non-private, mangling their names.". This name change necessitates a rehashing of the owning scope, which I suspect is enough to corrupt the ScopeEntry-s being traversed in `checkNoDeclaredDoubleDefs`. The upshot was that we encountered the same symbol twice, which was reported as being a double-definition. This problem only showed up after 086702d8a74, which did nothing worse then change the order in which `{e, e1}.sym.info` were forced. I inspected SymbolPairs/OverridingPairs which *appear* to be immune as they only test flags during scope iteration; infos are not used until later, at which point we're iterating a temporary scope that isn't part of the type of the owner of the symbols.
* Merge pull request #3180 from xeno-by/topic/toolbox-rangeposJason Zaugg2013-11-262-0/+9
|\ | | | | teaches toolbox about -Yrangepos
| * [nomaster] teaches toolbox about -YrangeposEugene Burmako2013-11-222-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | Unlike in master, in 2.10.x enabling -Yrangepos requires instantiating Global with mixed in RangePositions trait. Same story for toolboxes. Just setting Yrangepos is not enough - one needs to mix in RangePositions into ToolboxGlobal. I didn’t know that back then, so now I’m fixing the oversight. The commit is marked as [nomaster], because -Yrangepos doesn’t need special treatment in master.
* | SI-8005 Fixes NoPositon error for updateDynamic callsSimon Schaefer2013-11-262-0/+42
| | | | | | | | | | | | | | | | Previously there occurred a NoPosition error when one asks for position information in the AST because no positions were set to the trees created during the transformation for updateDynamic calls. This commit applies range positions to the trees in order to being able to highlight them inside of the scala-ide.
* | SI-8004 Resolve NoPosition error for applyDynamicNamed method callSimon Schaefer2013-11-262-0/+40
| | | | | | | | | | | | | | | | | | Previously, there were no positions created for the tuples that are generated while doing the transformation for an applyDynamicNamed call. This led to an NoPosition error in scalac when one tries to show position information in the AST. Furthermore, this simplifies semantic highlighting in the scala-ide because no position information for color ranges have to be created anymore.
* | SI-7463,SI-8003 Correct wrong position for {select,apply}Dynamic callsSimon Schaefer2013-11-264-0/+78
|/ | | | | | | | | | | | The new positions are range positions that directly refer to the beginning and the end of the method calls in the sources instead of simply point to the beginning of the expression. This allows the scala-ide to semantically highlight select- and applyDynamic method calls, because it has only to traverse the tree and apply the color ranges to the given position ranges. This also fixes the position marker of an error messages related to a wrong Dynamic method signature.
* SI-6546 InnerClasses attribute refers to absent classPaul Phillips2013-11-043-0/+15
| | | | | | | | | | | | | | | | | | | | | | At issue is that the optimizer would eliminate closure classes completely, then neglect to eliminate those classes from the container's InnerClasses attribute. This breaks tooling which expects those entries to correspond to real classes. The code change is essentially mgarcia's - I minimized it and put the caches in perRunCaches, and added the test case which verifies that after being compiled under -optimise, there are no inner classes. Before/after: 7,8d6 < InnerClasses: < public final #22; //class A_1$$anonfun$f$1 37,45c35,40 < #21 = Utf8 A_1$$anonfun$f$1 < #22 = Class #21 // A_1$$anonfun$f$1 < #23 = Utf8 Code --- > #21 = Utf8 Code
* Merge pull request #2985 from retronym/ticket/7783Jason Zaugg2013-10-031-3/+0
|\ | | | | Don't issue deprecation warnings for inferred TypeTrees
| * SI-7783 Don't issue deprecation warnings for inferred TypeTreesJason Zaugg2013-09-271-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Deprecation checks in RefChecks were looking into all TypeTrees to find references to deprecated type aliases. However, when the compiler infers a type argument or type of a member it creates a TypeTree (with a null original) that was also leading to warnings. I ran into this problem often when upgrading a build from SBT 0.12 to 0.13: a plugin I was using used the deprecated type alias, and I suffered transitively when I used methods from its API. This commit disables the checks for inferred TypeTree-s.
* | SI-7861 Don't execute internal callbacks on the user ExecutorJason Zaugg2013-09-212-0/+67
|/ | | | | | | | | | | | | | | | | | | | | | Callbacks internal to the implementation of Futures should be executed with the `InternalCallbackExecutor`, rather than the user supplied `Executor`. In a refactoring da54f34a6, `recoverWith` and `flatMap` no longer played by these rules. This was noticed by a persnickety test in Play. Before this patch, the enclosed test outputs: % scala-hash v2.10.3-RC2 test/files/run/future-flatmap-exec-count.scala mapping execute() flatmapping execute() execute() recovering execute() execute()
* Merge pull request #2923 from retronym/ticket/7825Grzegorz Kossakowski2013-09-112-4/+36
|\ | | | | SI-7825 Consider DEFAULTMETHOD when refchecking concreteness
| * SI-7398 Enable test for Java 8 source parser under Java 8Jason Zaugg2013-09-101-4/+2
| | | | | | | | | | There is no need to skip it as it only depends on our changes to our JavaParser, and not on any bytecode features of Java 8.
| * SI-7825 Consider DEFAULTMETHOD when refchecking concretenessJason Zaugg2013-09-101-0/+34
| | | | | | | | | | | | | | | | | | | | A class should not be required to implement a Java default method. This commit uses `isDeferredNotDefault` in place of `isDeferred` when finding unimplemented methods. The test itself does not depend on Java 8 as we use scalac's Java source parser to set things up.
* | Merge pull request #2866 from retronym/ticket/7269Jason Zaugg2013-09-091-0/+32
|\ \ | | | | | | SI-7269 Rework MapLike#retains to account for desugaring change
| * | SI-7269 Rework MapLike#retains to account for desugaring changeJason Zaugg2013-08-291-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `MapLike#retains` contains a for-comprehension that relied on the strict `filter` by its generator. You can't, in general, iterate a mutable map and remove items in the same pass. Here's the history of the desugaring of: def retain[A, B](thiz: mutable.Map[A, B])(p: (A, B) => Boolean): thiz.type = { thiz.foreach { case (k, v) => if (p(k, v)) thiz -= k } Before regression (c82ecabad6~1): thiz.filter(((check$ifrefutable$1) => check$ifrefutable$1: @scala.unchecked match { case scala.Tuple2((k @ _), (v @ _)) => true case _ => false })).withFilter(((x$1) => x$1: @scala.unchecked match { case scala.Tuple2((k @ _), (v @ _)) => p(k, v).unary_$bang })).foreach(((x$2) => x$2: @scala.unchecked match { case scala.Tuple2((k @ _), (v @ _)) => thiz.$minus$eq(k) })); After regression (c82ecabad6, which incorrectly assumed in the parser that no filter is required for isInstanceOf[Tuple2]) thiz.withFilter(((x$1) => x$1: @scala.unchecked match { case scala.Tuple2((k @ _), (v @ _)) => p(k, v).unary_$bang })).foreach(((x$2) => x$2: @scala.unchecked match { case scala.Tuple2((k @ _), (v @ _)) => thiz.$minus$eq(k) })); After the reversion of c82ecabad6, v2.10.2 This is also after 365bb2b4e, which uses `withFilter` rather than `filter`. thiz.withFilter(((check$q$1) => check$ifrefutable$1: @scala.unchecked match { case scala.Tuple2((k @ _), (v @ _)) => true case _ => false })).withFilter(((x$1) => x$1: @scala.unchecked match { case scala.Tuple2((k @ _), (v @ _)) => p(k, v).unary_$bang })).foreach(((x$2) => x$2: @scala.unchecked match { case scala.Tuple2((k @ _), (v @ _)) => thiz.$minus$eq(k) })); This commit does the same as `SetLike#retains`, and converts the map to an immutable list before the rest of the operation.
* | | SI-7814 Avoid init cycle between Predef, `package`, ScalaRuntimeJason Zaugg2013-09-051-0/+71
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Not every application will force these in a single thread; we have to do our best to avoid cycles between them. The enclosed test was failing every time before the change. This commit breaks the cycle by avoiding computing `tupleNames` in the constructor of `ScalaRuntime`. The new version has the added benefit of including specialized tuple subclasses, which is verified with a unit test for `isTuple`. Are there more of these lurking? It seems likely. I'm more than a little concerned about the way the `ControlThrowable` fires up `scala.SystemProperties` to check whether or not to suppress stack traces; there is already an ugly hack in place: object NoStackTrace { final def noSuppression = _noSuppression // two-stage init to make checkinit happy, // since sys.SystemProperties.noTraceSupression.value // calls back into NoStackTrace.noSuppression final private var _noSuppression = false _noSuppression = sys.SystemProperties.noTraceSupression.value }
* | Merge pull request #2888 from xeno-by/topic/typed-annotatedJason Zaugg2013-09-043-0/+21
|\ \ | | | | | | typedAnnotated no longer emits nulls
| * | typedAnnotated no longer emits nullsEugene Burmako2013-08-293-0/+21
| |/ | | | | | | | | | | Adds a null-check in original synthesis for the result of typedAnnotated. Previously it was possible for the aforementioned result to look like TypeTree(<tpe>) setOriginal Annotated(..., null). Not anymore.
* | SI-7150 Replace scala.reflect.internal.WeakHashSetGrzegorz Kossakowski2013-09-031-0/+174
| | | | | | | | | | | | | | Replaces scala.reflect.internal.WeakHashSet with a version that * extends the mutable.Set trait * doesn't leak WeakReferences * is unit tested
* | Merge pull request #2868 from retronym/ticket/7775Jason Zaugg2013-08-291-0/+17
|\ \ | | | | | | SI-7775 Harden against the shifting sands of System.getProperties
| * | SI-7775 Harden against the shifting sands of System.getPropertiesJason Zaugg2013-08-261-0/+17
| |/ | | | | | | | | | | | | | | | | | | | | | | | | If another thread writes a new system property (which can happen in pretty innocuous code such as `new Date`!), the compiler startup could fail with a `ConcurrentModificationException` as it iterated all bindings in the properties map in search of a boot classpath property for esoteric JVMs. This commit uses `Properties#getStringProperties` to get a snapshot of the keys that isn't backed by the live map, and iterates these instead. That method will also limit us to bindings with String values, which is all that we expect.
* / SI-7779 Account for class name compactification in reflectionJason Zaugg2013-08-231-0/+67
|/ | | | | | | | | | | | | | | We have to assume that the classes we are reflecting on were compiled with the default value for -Xmax-classfile-name (255). With this assumption, we can apply the same name compactification as done in the regular compiler. The REPL is particularly prone to generating long class names with the '$iw' prefixes, so this is an important fix for runtime reflection. Also adds support for getting the runtime class of `O.type` if `O` is a module.
* Merge pull request #2814 from xeno-by/topic/auto-duplicate-expansionsJames Iry2013-08-167-0/+57
|\ | | | | [nomaster] macro expansions are now auto-duplicated
| * [nomaster] macro expansions are now auto-duplicatedEugene Burmako2013-08-147-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The fix still requires macro developers to be careful about sharing trees by references, because attributed DefTrees will still bring trouble. However this is an improvement, because it doesn't make matters worse and automatically fixes situations similar to one in the test. A much more thorough discussion with a number of open questions left: http://groups.google.com/group/scala-internals/browse_thread/thread/492560d941b315cc Was fixed ages ago in master in one of the paradise backports. Never got to 2.10.x, but it's very useful, so I'm backporting it now.
* | Merge pull request #2809 from xeno-by/ticket/7733James Iry2013-08-133-0/+15
|\ \ | | | | | | SI-7733 reflective packages now more consistent with scalac
| * | [nomaster] SI-7733 reflective packages now more consistent with scalacEugene Burmako2013-08-133-0/+15
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | Previously PackageScopes from scala.reflect ignored all classes that had $'s in non-rightmost positions in their names. Unfortunately this behaviour is inconsistent with how scalac does things, and I reconciled this as usual, by pulling corresponding logic into scala-reflect.jar and sharing it between runtime reflection and compiler. This change has seprate pull requests for 2.10.x and 2.11.0. The latter deprecates `scala.tools.nsc.util.ClassPath.isTraitImplementation` whereas the former (which you're looking at right now) does not, because we can't deprecated members in minor releases.
* | Merge pull request #2813 from xeno-by/topic/showrawGrzegorz Kossakowski2013-08-121-1/+1
|\ \ | | | | | | showRaw now prints symbols of def trees
| * | showRaw now prints symbols of def treesEugene Burmako2013-08-101-1/+1
| | | | | | | | | | | | A very useful addition that came in handy when hacking macro annotations
* | | currentRun.compiles now correctly works in toolboxesEugene Burmako2013-08-102-0/+30
| |/ |/| | | | | Another random bug uncovered and extinguished when hacking macro annots.
* | SI-7331 tb.parse returns unpositioned treesDen Shabalin2013-08-086-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit gets rid off code wrapping that was previously used by toolbox to get into correct parsing mode. Instead combination of templateStats/accept(EOF) is used. This is the same solution as the one used in repl and built-in scriptRunner This pull request doesn't attempt to generalize this approach in any way and re-use it all over the place due to the caution of possible accidental compatibility breakage. I plan to do it separately against master. Additionally there are a few more changes that make importers be aware of positions and a test for that (via @jedesah).
* | Merge pull request #2761 from scalamacros/ticket/7510Jason Zaugg2013-08-015-1/+38
|\ \ | | | | | | Assorted toolbox fixes
| * | brings JavaMirrors up to speed with ClassfileParserEugene Burmako2013-07-235-1/+38
| | | | | | | | | | | | | | | | | | | | | Apparently there are still discrepancies between how the vanilla compiler turns class files into symbols and how the reflective compiler does it. Working on bringing these guys in sync, one bug at a time.
* | | Merge pull request #2750 from retronym/ticket/7455-2.10.xGrzegorz Kossakowski2013-07-273-0/+65
|\ \ \ | |_|/ |/| | SI-7455 Drop dummy param for synthetic access constructor
| * | SI-7455 Drop dummy param for synthetic access constructorJason Zaugg2013-07-283-0/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Java synthesizes public constructors in private classes to allow access from inner classes. The signature of that synthetic constructor (known as a "access constructor") has a dummy parameter appended to avoid overloading clashes. javac chooses the type "Enclosing$1" for the dummy parameter (called the "access constructor tag") which is either an existing anonymous class or a synthesized class for this purpose. In OpenJDK, this transformation is performed in: langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java (Incidentally, scalac would just emits a byte-code public constructor in this situation, rather than a private constructor / access constructor pair.) Scala parses the signature of the access contructor, and drops the $outer parameter, but retains the dummy parameter. This causes havoc when it tries to parse the bytecode for that anonymous class; the class file parser doesn't have the enclosing type parameters of Vector in scope and crash ensues. In any case, we shouldn't allow user code to see that constructor; it should only be called from within its own compilation unit. This commit drops the dummy parameter from access constructor signatures in class file parsing.