summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/master' into topic/palladium0Eugene Burmako2014-02-16139-949/+2539
|\ | | | | | | | | | | | | | | Conflicts: src/compiler/scala/reflect/macros/compiler/Resolvers.scala src/compiler/scala/reflect/macros/contexts/Typers.scala src/compiler/scala/tools/reflect/ToolBoxFactory.scala src/reflect/scala/reflect/api/BuildUtils.scala
| * Merge pull request #3397 from xeno-by/ticket/5920Jason Zaugg2014-02-1637-142/+431
| |\ | | | | | | SI-5920 enables default and named args in macros
| | * SI-5920 enables default and named args in macrosEugene Burmako2014-02-1026-119/+384
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When producing an initial spec for macros two years ago, we sort of glossed over named/default arguments in macro applications, leaving them for future work. Once the aforementioned future has come, I’ve made several attempts at making things operational (e.g. last summer), but it’s always been unclear how to marry the quite complex desugaring that tryNamesDefaults performs with the expectations of macro programmers to see unsugared trees in macro impl parameters. Here’s the list of problems that arise when trying to encode named/default arguments of macro applications: 1) When inside macro impls we don’t really care about synthetic vals that are typically introduced to preserve evaluation order in non-positional method applications. When we inline those synthetics, we lose information about evaluation order, which is something that we wouldn’t like to lose in the general case. 2) More importantly, it’s also not very exciting to see invocations of default getters that stand for unspecified default arguments. Ideally, we would like to provide macro programmers with right-hand sides of those default getters, but that is: a) impossible in the current implementation of default parameters, b) would anyway bring scoping problems that we’re not ready to deal with just yet. Being constantly unhappy with potential solutions to the aforementioned problems, I’ve been unable to nail this down until the last weekend, when I realized that: 1) even though we can’t express potential twists in evaluation order within linearly ordered macro impl params, we can use c.macroApplication to store all the named arguments we want, 2) even though we can’t get exactly what we want for default arguments, we can represent them with EmptyTree’s, which is not ideal, but pretty workable. That’s what has been put into life in this commit. As a pleasant side-effect, now the macro engine doesn’t have to reinvent the wheel wrt reporting errors about insufficient arg or arglist count. Since this logic is intertwined with the tryNamesDefaults desugaring, we previously couldn’t make use of it and had to roll our own logic that checked that the number of arguments and parameters of macro applications correspond to each other. Now it’s all deduplicated and consistent.
| | * introduces -Yshow-symownersEugene Burmako2014-02-108-40/+58
| | | | | | | | | | | | | | | | | | This facility, along with -Yshow-syms, has proven to be very useful when debugging problems caused by corrupt owner chains when hacking on named/default argument transformation.
| | * deduplication in Symbol.nameStringEugene Burmako2014-02-101-2/+1
| | | | | | | | | | | | | | | Since now it uses idString to print out the id part of the name when -uniqid is turned on, instead of duplicating the code from idString.
| | * standardizes checks for default gettersEugene Burmako2014-02-103-2/+7
| | |
| | * standardizes prefixes used in named/default desugaringEugene Burmako2014-02-102-2/+4
| | |
| * | Merge pull request #3499 from densh/topic/single-element-tupleEugene Burmako2014-02-168-11/+26
| |\ \ | | | | | | | | Make handling of tuples more consistent in quasi-quotes
| | * | Make handling of tuples more consistent in quasi-quotesDenys Shabalin2014-02-108-11/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On one hand we know that q"($expr)" is the same as q"$expr". On the other if we wrap it into a list and splice as q"(..$expr)" we get a Tuple1 constructor call which is inconsistent. This pull request fixes this inconsistency by making q"(..$expr)" being equivalent q"(${expr.head})" for single-element list. We also add support for matching of expressions as single-element tuples (similarly to blocks) and remove liftables and unliftables for Tuple1 (which aren't clearly defined any longer due to q"(foo)" == q"foo" invariant).
| * | | Merge pull request #3521 from xeno-by/ticket/8270Jason Zaugg2014-02-1616-308/+454
| |\ \ \ | | | | | | | | | | SI-8270 unconfuses bundles and vanilla macros
| | * | | SI-8270 unconfuses bundles and vanilla macrosEugene Burmako2014-02-1316-308/+454
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a mistake in macro impl ref typechecking that used to have an heuristic to figure out whether it looks at a bundle method ref or at a vanilla object method ref. Under some circumstances the heuristic could fail, and then the macro engine would reject perfectly good macro impls. Now every macro impl ref is typechecked twice - once as a bundle method ref and once as a vanilla object method ref. Results are then analyzed, checked against ambiguities (which are now correctly reported instead of incorrectly prioritizing towards bundles) and delivered to the macro engine. The only heuristic left in place is the one that's used to report errors. If both bundle and vanilla typechecks fail, then if a bundle candidate looks sufficiently similar to a bundle, a bundle typecheck error is reported providing some common bundle definition hints.
| * | | | Merge pull request #3513 from xeno-by/topic/typecheck-member-defsJason Zaugg2014-02-167-69/+86
| |\ \ \ \ | | | | | | | | | | | | typecheck(q"class C") no longer crashes
| | * | | | typecheck(q"class C") no longer crashesEugene Burmako2014-02-127-69/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | | | Merge pull request #3455 from densh/topic/patdefEugene Burmako2014-02-1612-110/+228
| |\ \ \ \ \ | | | | | | | | | | | | | | Fix SI-8202 and improve support for splicing patterns into vals
| | * | | | | Improve support for patterns in valsDenys Shabalin2014-02-098-53/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commits adds construction-only support for splicing patterns into vals (a.k.a. PatDef). Due to non-locality of the desugaring it would have been quite expensive to support deconstruction as the only way to do it with current trees is to perform implodePatDefs transformation on every single tree.
| | * | | | | Move null check case higher to avoid NPEDenys Shabalin2014-02-091-27/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Also use sym.isErrorneous instead of manual name check.
| | * | | | | Move placeholder construction logic into PlaceholdersDenys Shabalin2014-02-093-30/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously construction logic used to be in Parsers and deconstruction in Placeholders making it easy to forget one if you change the other.
| | * | | | | SI-8202 bug compatibility with SI-8211 for quasiquotesDenys Shabalin2014-02-094-1/+13
| | | |_|/ / | | |/| | |
| * | | | | Merge pull request #3493 from retronym/ticket/3452-2Grzegorz Kossakowski2014-02-1640-263/+840
| |\ \ \ \ \ | | | | | | | | | | | | | | SI-3452 Correct Java generic signatures for mixins, static forwarders
| | * | | | | SI-3452 GenBCode version of the static-forwarder signature fixJason Zaugg2014-02-156-1/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Shares the code with the GenASM version of the fix.
| | * | | | | SI-3452 Reduce low-hanging duplication bewteen GenASM and GenBCodeJason Zaugg2014-02-152-123/+4
| | | | | | |
| | * | | | | SI-3452 Refactoring code in GenASMJason Zaugg2014-02-151-145/+146
| | | | | | | | | | | | | | | | | | | | | | | | | | | | For a non copypasta for of reuse in GenBCode.
| | * | | | | SI-3452 A better fix for static forwarder generic sigsJason Zaugg2014-02-154-16/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous commit fixed this in the wrong way. The addition to the test case (testing an inherited method from a base class in addition to the test with a mxin method) still failed. Like mixin, static forwarder generation uses the exact erased siganture of the forwardee for the forwarder. It really ought to use the as-seen-from signature (adding requisite boxing/ unboxing), but until we do that we have to avoid emitting generic signatures that are incoherent.
| | * | | | | SI-7374 Test cases for fixed Java interop problemJason Zaugg2014-02-093-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our generic signatures now match the erasure, so no more nasty linkage errors.
| | * | | | | SI-3452 Correct Java generic signatures for mixins, static forwardersJason Zaugg2014-02-0931-13/+649
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [Parts of this patch and some of the commentary are from @paulp] This took me so long to figure out I can't even tell you. Partly because there were two different bugs, one which only arose for trait forwarders and one for mirror class forwarders, and every time I'd make one set of tests work another set would start failing. The runtime failures associated with these bugs were fairly well hidden because you usually have to go through java to encounter them: scala doesn't pay that much attention to generic signatures, so they can be wrong and scala might still generate correct code. But java is not so lucky. Bug #1) During mixin composition, classes which extend traits receive forwarders to the implementations. An attempt was made to give these the correct info (in method "cloneBeforeErasure") but it was prone to giving the wrong answer, because: the key attribute which the forwarder must capture is what the underlying method will erase to *where the implementation is*, not how it appears to the class which contains it. That means the signature of the forwarder must be no more precise than the signature of the inherited implementation unless additional measures will be taken. This subtle difference will put on an unsubtle show for you in test run/t3452.scala. trait C[T] trait Search[M] { def search(input: M): C[Int] = null } object StringSearch extends Search[String] { } StringSearch.search("test"); // java // java.lang.NoSuchMethodError: StringSearch.search(Ljava/lang/String;)LC; The principled thing to do here would be to create a pair of methods in the host class: a mixin forwarder with the erased signature `(String)C[Int]`, and a bridge method with the same erased signature as the trait interface facet. But, this turns out to be pretty hard to retrofit onto the current setup of Mixin and Erasure, mostly due to the fact that mixin happens after erasure which has already taken care of bridging. For a future, release, we should try to move all bridging after mixin, and pursue this approach. But for now, what can we do about `LinkageError`s for Java clients? This commit simply checks if the pre-erasure method signature that we generate for the trait forward erases identically to that of the interface method. If so, we can be precise. If not, we emit the erased signature as the generic signature. Bug #2) The same principle is at work, at a different location. During genjvm, objects without declared companion classes are given static forwarders in the corresponding class, e.g. object Foo { def bar = 5 } which creates these classes (taking minor liberties): class Foo$ { static val MODULE$ = new Foo$ ; def bar = 5 } class Foo { static def bar = Foo$.MODULE$.bar } In generating these, genjvm circumvented the usual process whereby one creates a symbol and gives it an info, preferring to target the bytecode directly. However generic signatures are calculated from symbol info (in this case reusing the info from the module class.) Lacking even the attempt which was being made in mixin to "clone before erasure", we would have runtime failures of this kind: abstract class Foo { type T def f(x: T): List[T] = List() } object Bar extends Foo { type T = String } Bar.f(""); // java // java.lang.NoSuchMethodError: Bar.f(Ljava/lang/String;)Lscala/collection/immutable/List; Before/after this commit: < signature f (Ljava/lang/String;)Lscala/collection/immutable/List<Ljava/lang/String;>; --- > signature f (Ljava/lang/Object;)Lscala/collection/immutable/List<Ljava/lang/Object;>; This takes the warning count for compiling collections under `-Ycheck:jvm` from 1521 to 26.
| * | | | | | Merge pull request #3511 from som-snytt/issue/interp-octalAdriaan Moors2014-02-157-4/+124
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-8266 Deprecate octal escapes in f-interpolator
| | * | | | | | SI-8266 Deprecate octal escapes in f-interpolatorSom Snytt2014-02-117-4/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also turns the f-interpolator into a migration assistant by suggesting alternatives for the standard escapes.
| * | | | | | | Merge pull request #3528 from Ichoran/issue/6908Adriaan Moors2014-02-152-4/+10
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | SI-6908 FlatHashTable and things that depend on it can't store nulls
| | * | | | | | | Made ParFlatHashTableIterator private vars private[this].Rex Kerr2014-02-151-3/+3
| | | | | | | | |
| | * | | | | | | SI-6908 FlatHashTable and things that depend on it can't store nullsRex Kerr2014-02-132-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed ParFlatHashTable to use entryToElem which correctly converts sentinels to nulls.
| * | | | | | | | Merge pull request #3527 from Ichoran/issue/8264Adriaan Moors2014-02-153-6/+14
| |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | SI-8264 scala.collection.immutable.HashSet#- returns broken Set
| | * | | | | | | | SI-8264 scala.collection.immutable.HashSet#- returns broken SetRex Kerr2014-02-143-6/+14
| | |/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Was an error in HashSet's handling of removal of an element when a HashTrieSet should turn into a HashSet1. Also slightly modified HashMap's filter0 to more closely match HashSet (by adding the same comment).
| * | | | | | | | Merge pull request #3443 from gourlaysama/man-pagesAdriaan Moors2014-02-151-0/+3
| |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | add -Xsource:version to scalac man page
| | * | | | | | | | add -Xsource:version to scalac man pageAntoine Gourlay2014-01-311-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The flag was added in d43618a (PR #3340) by @huitseeker.
| * | | | | | | | | Merge pull request #3532 from som-snytt/issue/7711Adriaan Moors2014-02-158-13/+31
| |\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | SI-7711 Do not emit extra argv in script body
| | * | | | | | | | | SI-7711 Test for args in scriptSom Snytt2014-02-144-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Compiles with -Xlint to ensure there are no lurkers. Updates `ScriptTest` to pass args to the script. It's called `argv` partly as homage, partly because `args` is an `Array`.
| | * | | | | | | | | SI-7711 Do not emit extra argv in script bodySom Snytt2014-02-144-12/+8
| | | |_|/ / / / / / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Take away `argv` and make `args` the standard parameter name. This is a quick fix to avoid "unused local" lint error. All the examples use `args`; in particular, "Step 4. Write some Scala scripts" in "Programming in Scala" uses `args`. I see the footnote there is also where Odersky concatenation is specified, `"Hello, "+ args(0) +"!"` with no space next to the literals. Also removes `argv` from `StdNames`. Was torn whether just to add `argc`. Maybe start a new project to house Names, emeritus.
| * | | | | | | | | Merge pull request #3534 from clhodapp/test/literate_existentialsAdriaan Moors2014-02-152-0/+228
| |\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Add an extremely well-commented test
| | * | | | | | | | | Add an extremely well-commented testclhodapp2014-02-142-0/+228
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit includes a test for some simple existential subtyping checks. It is exceptionally well-commented and may be helpful to someone trying to figure out what the rules are (supposed to be) in the future.
| * | | | | | | | | | Merge pull request #3533 from adriaanm/t8283Adriaan Moors2014-02-144-41/+84
| |\ \ \ \ \ \ \ \ \ \ | | |/ / / / / / / / / | |/| | | | | | | | | SI-8283 mutation-free bound inference for existentials
| | * | | | | | | | | SI-8283 mutation-free bound inference for existentialsJason Zaugg2014-02-144-41/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A safer version of the fix for SI-6169 (#3471) Only modify the skolems to avoid leaking the sharper bounds to `quantified`. The included test case was minimized from akka-camel (src/main/scala/akka/camel/Consumer.scala).
* | | | | | | | | | | adds missing signature of appliedTypeEugene Burmako2014-02-152-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Again, thanks to sbt.
* | | | | | | | | | | adds more tests for enclosingOwnersEugene Burmako2014-02-156-0/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Makes sure that it's possible to cover sbt's use cases, and also checks that we can distinguish vals from vars (should anyone ever need that).
* | | | | | | | | | | updates deprecation hints in compatEugene Burmako2014-02-152-35/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now when we have internal.decorators, it is reasonable to advertise them to the users.
* | | | | | | | | | | some extension methods that I forgot to exposeEugene Burmako2014-02-153-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Thanks, sbt. Once I'm done with sbt, I'll write up tests that ensure that I haven't forgotten anything.
* | | | | | | | | | | fixes compat for tree and type extractorsEugene Burmako2014-02-156-225/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When I removed XXXDef(...) and XXXType(...) methods from the public API, I put compatibility stubs in compat via implicit classes enriching XXXExtractor traits with apply methods. Unfortunately, this doesn't work, because if XXXDef or XXXType have any kind of an apply method left in the public API, then implicit classes won't even be considered when resolving calls to XXXDef(...) or XXXType(...). Therefore I had to put those removed methods back and adorn them with an implicit parameter that can only be resolved when "import compat._" is in place. Quite extravagant, yes, but goes along the lines with the design goals of the refactoring, which are: 1) Break source compatibility for users who are using methods that are now moved to internal in order to attract attention. 2) Provide an easy way to fix the breakage by importing compat._, which will pimp back all the missing APIs with deprecation warnings that are going to guide migration.
* | | | | | | | | | | exposes scope mutation APIsEugene Burmako2014-02-153-1/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also needed for async.
* | | | | | | | | | | SI-6785 exposes Symbol.flags, setFlag and resetFlagEugene Burmako2014-02-153-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | My first feeling was not to expose Symbol.flags, because that would inevitably lead to exposing more methods on FlagSet. However we do need flag manipulation in async, which is representative of advanced macros, so I'm caving in.
* | | | | | | | | | | exposes Symbol.setOwnerEugene Burmako2014-02-152-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Used by async.
* | | | | | | | | | | better appliedType signaturesEugene Burmako2014-02-152-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our users deserve better than this mouthful: `appliedType(sym.asType.toTypeConstructor, List(targ1, ...))`