summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* SI-7752 Don't disambiguate type parameters of overloaded altsJason Zaugg2013-08-151-4/+7
| | | | | | | | | | | | | | | | | These are passed through from `InferencerContextErrors#applyErrorMsg` to `withDisambiguation` as the `locals` parameter, which is promptly ignored. This looks to be an unintended change in 39938bcc299. Without this patch, the enclosed test case enters a pathalogical disambiguation session, that not only flirts with unpleasant big-O complexities, but also flails about appending "(in method foo)" only to find that *all* occurences of the same-named type parameter come from some method named "foo". [snipping error message 40 seconds in the making] method foo), O(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo), P(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo), Q(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo), R(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo), S(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo), T, U(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo), V) cannot be applied to (Int) foo((1))
* Merge pull request #2829 from adriaanm/ticket-7014James Iry2013-08-141-3/+8
|\ | | | | SI-7014 Annot arg may refer to annotated class's member
| * SI-7014 Annot arg may refer to annotated class's memberAdriaan Moors2013-08-131-3/+8
| | | | | | | | This only reduces the crasher to a warning.
* | Merge pull request #2828 from adriaanm/rebase-2771James Iry2013-08-135-13/+67
|\ \ | | | | | | [Rebase #2771] SI-7694 @uncheckedBounds, an opt-out from type bounds checking
| * | SI-7694 Add @uncheckedBounds to the libraryJason Zaugg2013-08-131-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | Followup to the previous commit that added the compiler support for opting out of bounds checking. With both pieces, we can test that the temporaries introduced by the named/default arguments transform don't trigger bounds violations.
| * | SI-7694 @uncheckedBounds, an opt-out from type bounds checkingJason Zaugg2013-08-134-13/+54
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Synthetic defs introduced by transforms like named/default arguments, ANF (in scala-async) often introduce a type tree (the tpt of the temporary) that are based on the types of expressions. These types are scrutinized in RefChecks to check that type parameter bounds are satisfied. However, the type of the expression might be based on slack a LUB that fails to capture constraints between type parameters. This slackness is noted in `mergePrefixAndArgs`: // Martin: I removed this, because incomplete. Not sure there is a // good way to fix it. For the moment we just err on the conservative // side, i.e. with a bound that is too high. The synthesizer can now opt out of bounds by annotating the type as follows: val temp: (<expr.tpe> @uncheckedBounds) = expr This facility is now used in named/default arguments for the temporaries used for the reciever and arguments. The annotation is hidden under scala.reflect.internal, rather than in the more prominent scala.annotation.unchecked, to reflect the intention that it should only be used in tree transformers. The library component of this change and test case will be included in the next commit. Why split like this? It shows that the 2.10.3 compiler will work with 2.10.2 scala-reflect.jar.
* | Merge pull request #2826 from retronym/ticket/7020-2.10.xAdriaan Moors2013-08-131-4/+5
|\ \ | |/ |/| SI-7020 Determinism for pattern matcher warnings
| * SI-7020 Determinism for pattern matcher warningsJason Zaugg2013-08-131-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use LinkedHashSet for the DPLL algorithm for determistic counter example generation. Before, the test compiled with: [info] v2.10.2 => /Users/jason/usr/scala-v2.10.2-0-g60d462e test/files/neg/t7020.scala:3: warning: match may not be exhaustive. It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List(_, _) List(5) match { ^ test/files/neg/t7020.scala:10: warning: match may not be exhaustive. It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List(_, _) List(5) match { ^ test/files/neg/t7020.scala:17: warning: match may not be exhaustive. It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(??, _) List(5) match { ^ test/files/neg/t7020.scala:24: warning: match may not be exhaustive. It would fail on the following input: List(_, _) List(5) match { ^
* | Merge pull request #2809 from xeno-by/ticket/7733James Iry2013-08-135-14/+15
|\ \ | |/ |/| SI-7733 reflective packages now more consistent with scalac
| * [nomaster] SI-7733 reflective packages now more consistent with scalacEugene Burmako2013-08-135-14/+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-0/+2
|\ \ | | | | | | showRaw now prints symbols of def trees
| * | showRaw now prints symbols of def treesEugene Burmako2013-08-101-0/+2
| | | | | | | | | | | | A very useful addition that came in handy when hacking macro annotations
* | | Merge pull request #2817 from xeno-by/topic/toolbox-current-run-compilesJason Zaugg2013-08-121-1/+4
|\ \ \ | | | | | | | | currentRun.compiles now correctly works in toolboxes
| * | | currentRun.compiles now correctly works in toolboxesEugene Burmako2013-08-101-1/+4
| | |/ | |/| | | | | | | Another random bug uncovered and extinguished when hacking macro annots.
* / | [nomaster] macro errors now always have positionsEugene Burmako2013-08-101-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | Back then when I implemented macros for inclusion in trunk (Spring 2012), partest didn't support the _1, _2, ... convention for neg tests, so I had to use toolboxes to test macro-generated exceptions. Unfortunately toolboxes aren't very good with positions (mostly because their inputs are almost always constructed without corresponding sources) so I didn't notice that errors signalizing about macro-generated exceptions actually don't carry positions with them because of a typo. This patch fixes the oversight, but it doesn't need to be ported to master, because over there everything's already fixed by one of the backports from macro paradise.
* | SI-7331 tb.parse returns unpositioned treesDen Shabalin2013-08-082-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 #2767 from gourlaysama/t4907Adriaan Moors2013-08-051-2/+66
|\ \ | | | | | | SI-4907 SI-4615 scala.bat now honors -J and -D options.
| * | SI-4907 SI-4615 scala.bat honors -J and -D options.Antoine Gourlay2013-07-281-2/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes scala.bat parse and use -J and -D arguments. Specifically: - Parameters starting with -J are stripped of the prefix, unquoted if necessary and appended to %JAVA_OPTS% or default values. - Parameters starting with -D are unquoted if necessary and then appended to the others. The right-hand side of a property can be quoted or not. - All of those are given to `java` before any other parameters. - The above only happens on parameter preceding the first parameter that does not start with "-" (usually a class name). - The exact arguments passed to scala.bat are also given as-is to the scala launcher (including -J and -D arguments). set JAVA_OPTS=-Xmx512m scala -J-Xmx128m -Dprop1=42 -Dprop2="hello world" "-Dprop3=bar" "-J-Xms64m" Test foo will result in java -Xmx512m -Xmx128m -Dprop1=42 -Dprop2="hello world" -Dprop3=bar -Xms64m [cp, scala main] -J-Xmx128m -Dprop1=42 -Dprop2="hello world" "-Dprop3=bar" "-J-Xms64m" Test foo
* | | Merge pull request #2761 from scalamacros/ticket/7510Jason Zaugg2013-08-011-2/+11
|\ \ \ | | | | | | | | Assorted toolbox fixes
| * | | brings JavaMirrors up to speed with ClassfileParserEugene Burmako2013-07-231-2/+11
| |/ / | | | | | | | | | | | | | | | | | | 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-271-2/+11
|\ \ \ | | | | | | | | SI-7455 Drop dummy param for synthetic access constructor
| * | | SI-7455 Drop dummy param for synthetic access constructorJason Zaugg2013-07-281-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | Merge pull request #2738 from retronym/ticket/7636Grzegorz Kossakowski2013-07-271-0/+2
|\ \ \ \ | | | | | | | | | | SI-7636 Fix a NPE in typing class constructors
| * | | | SI-7636 Fix a NPE in typing class constructorsChristopher Vogt2013-07-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we encountered an erroneous super call due to a failure in parent type argument inference, we must avoid inspecting the untyped children of erroneous trees.
* | | | | Merge pull request #2762 from gourlaysama/t7687Grzegorz Kossakowski2013-07-271-1/+1
|\ \ \ \ \ | |_|_|_|/ |/| | | | SI-7687 Handle spaces in %COMSPEC% path in scala.bat.
| * | | | SI-7687 Handle spaces in %COMSPEC% path in scala.bat.Antoine Gourlay2013-07-231-1/+1
| | |_|/ | |/| | | | | | | | | | | | | | Double quoted %COMSPEC% to allow for spaces in the path to the default interpreter (cmd.exe or equivalent).
* / | | [backport] SI-7569 Fix end position in PostfixSelect treeFrançois Garillot2013-07-241-1/+1
|/ / / | | | | | | | | | | | | | | | | | | introduced in 5b54681: the end position of Postfix operators should take the operator length into account. review by @som-snytt
* / / SI-7657 clarifies the "macro overrides method" ruleEugene Burmako2013-07-141-2/+2
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we allow macros to override non-abstract methods (in order to provide performance enhancements such as foreach for collections), and we also disallow macros to override abstract methods (otherwise downcasting might lead to AbstractMethodErrors). This patch fixes an oversight in the disallowing rule that prohibited macros from overriding a concrete method if that concrete method itself overrides an abstract method. RefCheck entertains all overriding pairs, not only the immediate ones, so the disallowing rule was triggered. Now macros can override abstract methods if and only if either the base type or the self type contain a matching non-abstract method.
* | Merge pull request #2674 from richdougherty/2.10.x-si7336-try2Adriaan Moors2013-07-122-24/+197
|\ \ | | | | | | SI-7336 Link flatMapped promises to avoid memory leaks
| * | SI-7336 - Link flatMapped promises to avoid memory leaksRich Dougherty2013-07-062-24/+197
| |/
* | Merge pull request #2666 from som-snytt/issue/7265-spec-at-leastAdriaan Moors2013-07-121-10/+25
|\ \ | | | | | | SI-7265 General test for spec version
| * | SI-7265 General test for spec versionSom Snytt2013-07-041-10/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test for isJavaAtLeast uses the specification.version. The method argument must have the form "major.minor". The scaladoc is updated to reflect the new reality and a test is added under junit. Note that this implementation aims to be a simple compromise between the functional and imperative camps, that is, to be free of both closures and while loops. And to elicit no cruft like regexes and wrappers for strings. No doubt even more could be done in this department, but we don't wish to spoil the fun on codegolf.stackexchange.com. However, we might decide to sponsor a new site: codereviewpingpong.com For 2.10.x, javaSpecVersion is provided as a private member. The active test is under `run` and the `junit` test must bide its time in `pending`. For 2.11, the private members can be public and the app test replaced with the unit test.
* | | Merge pull request #2721 from retronym/ticket/7649Adriaan Moors2013-07-121-8/+8
|\ \ \ | | | | | | | | SI-7649 Fix positions for reshaped tag materializers
| * | | SI-7649 Fix positions for reshaped tag materializersJason Zaugg2013-07-111-8/+8
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | Calls to `materializeClassTag[T]` are replaced during reification with `implicitly[ClassTag[T]]` in the `reify` macro. This is done to avoid referring to symbols in scala-compiler.jar. Class- and Type-Tag materialization is treated in the same way. This commit positions the replacement trees to avoid triggering assertions under -Yrangepos.
* | | Merge pull request #2716 from SethTisue/terribly-important-typo-fixAdriaan Moors2013-07-122-2/+2
|\ \ \ | | | | | | | | fix typo in BigInt/BigDecimal deprecation messages
| * | | fix typo in BigInt/BigDecimal deprecation messagesSeth Tisue2013-07-082-2/+2
| |/ /
* | | Merge pull request #2689 from scalamacros/ticket/7617Adriaan Moors2013-07-122-3/+37
|\ \ \ | | | | | | | | SI-7617 typedAssign no longer expands lhs
| * | | SI-7617 typedAssign no longer expands lhsEugene Burmako2013-07-091-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes sure that setter and updateDynamic macros work as intended rather than in some cases expanding incorrectly or prematurely. Setter invocations are desugared from assignments of values to getters. If a typecheck of an assignment's lhs yields an invocation of a getter, then the assignment is rewritten into an invocation of a setter. However if a getter is a macro, then it just expands, destroying the prerequisite for desugaring. Therefore we need to disable expansion for the typecheck of an lhs. Similar thing happens to updateDynamic that first desugars a getter invocation into q"$target.updateDynamic($fieldName)" and then expects typedAssign to rewrite the corresponding Assign node into an additional application of a partially applied updateDynamic to a rhs. Here we also need to disable the typecheck of an lhs, because macros cannot be partially applied.
| * | | makes it more convenient to work with SuppressMacroExpansionAttachmentEugene Burmako2013-06-282-2/+33
| | | |
* | | | SI-7638 Superaccessor lookup after specializationVlad Ureche2013-07-081-1/+1
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The crash was caused by a symbol lookup to rewire the super calls, done after pickler, but specialization added new traits and new members, thus making the super rewiring impossible. To avoid such problems, this patch moves symbol lookup after specialization, so the changes done by specialization (and miniboxing) become visible to mixin. NOTE: This patch will be followed by a similar patch to master. Review by @adriaanm or @retronym.
* | | Merge pull request #2680 from retronym/ticket/7603Adriaan Moors2013-06-271-3/+12
|\ \ \ | | | | | | | | SI-7603 Speculative fix for annotation binding error
| * | | SI-7603 Speculative fix for annotation binding errorJason Zaugg2013-06-241-3/+12
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reports of: error: trait Test is abstract; cannot be instantiated 11:09:50 [ant:scalac] @Test def testClientRequestNum = { 11:09:50 [ant:scalac] ^ Suggest that the deferred processing of a LazyAnnotationInfo is binding the identifier `Test` to the wrong symbol. Inspection of the code shows that the closure also defers capture of the (mutable) field `Namer#typer.context`. This commit captures the context eagerly, and adds logging to let us know if that eagerly captured context ever differs from the its value at the point when the annotation info is forced. I spent a few hours trying to craft a test to back this up, but to no avail. Here's what the log output will look like: [log typer] The var `typer.context` in scala.tools.nsc.typechecker.Namers$NormalNamer@1f5ebb08 was mutated before the annotation new a() was forced. current value = Context(C@Import unit=<console> scope=123861466 errors=false, reportErrors=true, throwErrors=false) original value = Context(C@Import unit=<console> scope=123861466 errors=false, reportErrors=true, throwErrors=false) This confirms the hypothesis for the cause of SI-7603. If you see this message, please comment on that ticket.
* | | Merge pull request #2686 from retronym/topic/partest-task-no-stack-traceAdriaan Moors2013-06-271-2/+3
|\ \ \ | | | | | | | | Less noise on a partest failure.
| * | | Less noise on a partest failure.Jason Zaugg2013-06-271-2/+3
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Throwing a BuildException is the polite way to fail the Ant build. Before: BUILD FAILED /Users/jason/code/scala2/build.xml:1522: java.lang.RuntimeException: Test suite finished with 1 case failing: /Users/jason/code/scala2/test/files/pos/lub-dealias-widen.scala [FAILED] at scala.sys.package$.error(package.scala:27) [20 lines elided] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) Total time: 2 minutes 35 seconds After: BUILD FAILED /Users/jason/code/scala2/build.xml:1522: Test suite finished with 1 case failing: /Users/jason/code/scala2/test/files/pos/lub-dealias-widen.scala [FAILED] Total time: 2 minutes 34 seconds
* | | Merge pull request #2655 from VladUreche/issue/7344Adriaan Moors2013-06-261-24/+94
|\ \ \ | | | | | | | | SI-7344 Specialize methods in private scopes
| * | | SI-7344 Specialize methods in private scopesVlad Ureche2013-06-251-24/+94
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This performs method specialization inside a scope other than a {class, trait, object}: could be another method or a value. This specialization is much simpler, since there is no need to record the new members in the class signature, their signatures are only visible locally. It works according to the usual logic: - we use normalizeMember to create the specialized symbols - we leave DefDef stubs in the tree that are later filled in by tree duplication and adaptation The solution is limited by SI-7579: since the duplicator loses the sym annotations when duplicating, this expansion and rewiring can only take place in code that has not been subject to duplication. You can see the test case for an example. Review by @dragos, @paulp or @axel22.
* | | Merge pull request #2648 from retronym/ticket/7571Grzegorz Kossakowski2013-06-251-2/+2
|\ \ \ | | | | | | | | SI-7571 Allow nesting of anonymous classes in value classes
| * | | SI-7571 Allow nesting of anonymous classes in value classesJason Zaugg2013-06-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5d9cde105e added deep prohibition of nested classes within a value class. This has the undesirable side effect of prohibiting partial functions literals in method bodies of a value class. The intention of that prohibition was to avoid problems in code using Type Tests, such as: class C(val inner: A) extends AnyVal { class D } def foo(a: Any, other: C) = a match { case _ : other.D } Here, the pattern usually checks that `a.$outer == other`. But that is incongruent with the way that `other` is erased to `A`. However, not all nested classes could lead us into this trap. This commit slightly relaxes the restriction to allow anonymous classes, which can't appear in a type test. The test shows that the translation generates working code.
* | | | Merge pull request #2511 from ↵Adriaan Moors2013-06-241-137/+44
|\ \ \ \ | |_|/ / |/| | | | | | | | | | | viktorklang/wip-cleaner-Future-method-implementations-2.10-√ General SIP-14 Future method implementation cleanup
| * | | Cleaning up method implementations in FutureViktor Klang2013-06-191-137/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Optimizations: 1) Avoiding isDefinedAt + apply and using applyOrElse to allow for optimizations later 2) Reducing method sizes to be more JIT + inliner friendly 3) Reusing core combinators to reuse inliner/JIT optimizations and be more code-cache friendly