summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #3076 from soc/SI-7605-deprecate-proceduresJames Iry2013-10-291-1/+9
|\ | | | | SI-7605 Deprecate procedure syntax
| * SI-7605 Deprecate procedure syntaxSimon Ochsenreither2013-10-241-1/+9
| | | | | | | | | | | | | | | | | | | | This commit covers three cases: - constructor definitions (def this {...}) - concrete method definitions (def foo {...}) - abstract method declarations (def foo) The deprecation is currently hidden behind -Xfuture pending IDE support for migrating users from procedures to methods.
* | Merge pull request #3082 from retronym/ticket/6385Grzegorz Kossakowski2013-10-295-24/+34
|\ \ | | | | | | SI-6385 Avoid bridges to identical signatures over value classes
| * | SI-6385 Avoid bridges to identical signatures over value classesJason Zaugg2013-10-285-24/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As Paul noted in the comments to SI-6260 (from which I mined some test cases) "there is no possible basis for conflict here": scala> class C[A](val a: Any) extends AnyVal defined class C scala> class B { def x[A](ca: C[A]) = () } defined class B scala> class D extends B { override def x[A](ca: C[A]) = () } <console>:8: error: bridge generated for member method x: [A](ca: C[A])Unit in class D which overrides method x: [A](ca: C[A])Unit in class B clashes with definition of the member itself; both have erased type (ca: Object)Unit class D extends B { override def x[A](ca: C[A]) = () } ^ What was happening? Bridge computation compares `B#x` and `D#x` exitingErasure, which results in comparing: ErasedValueType(C[A(in B#x)]) =:= ErasedValueType(C[A(in D#x)]) These types were considered distinct (on the grounds of the unique type hash consing), even though they have the same erasure and involve the same value class. That triggered creation of an bridge. After post-erasure eliminates the `ErasedValuedType`s, we find that this marvel of enginineering is bridges `(Object)Unit` right back onto itself. The previous resolution of SI-6385 (d435f72e5fb7fe) was a test case that confirmed that we detected the zero-length bridge and reported it nicely, which happened after related work in SI-6260. But we can simply avoid creating in it in the first place. That's what this commit does. It does so by reducing the amount of information carried in `ErasedValueType` to the bare minimum needed during the erasure -> posterasure transition. We need to know: 1. which value class wraps the value, so we can box and unbox as needed 2. the erasure of the underlying value, which will replace this type in post-erasure. This construction means that the bridge above computation now compares: ErasedValueType(C, Any) =:= ErasedValueType(C, Any]) I have included a test to show that: - we don't incur any linkage or other runtime errors in the reported case (run/t6385.scala) - a similar case compiles when the signatures align (pos/t6260a.scala), but does *not* compile when the just erasures align (neg/t6260c.scala) - polymorphic value classes continue to erase to the instantiated type of the unbox: (run/t6260b.scala) - other cases in SI-6260 remains unsolved and indeed unsolvable without an overhaul of value classes: (neg/t6260b.scala) In my travels I spotted a bug in corner case of null, asInstanceOf and value classes, which I have described in a pending test.
* | | Merge pull request #3069 from adriaanm/build-maven-publishAdriaan Moors2013-10-2811-738/+460
|\ \ \ | |/ / |/| | Rework build to allow publishing core to maven
| * | Tidy pom xml files.Adriaan Moors2013-10-257-366/+358
| | |
| * | Fail build on error in signed maven publish.Adriaan Moors2013-10-251-1/+1
| | |
| * | Build cleanup. Prepare for scaladoc module build.Adriaan Moors2013-10-221-11/+10
| | |
| * | Towards minimal build for publishing core to maven.Adriaan Moors2013-10-222-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use `unless` attribute in targets so that `docs.skip` influences dependency graph. Create `scaladoc` task in `pack.core` so that we don't need `pack.done` for publishing the core. Move source bundle creation from `dist.src` to `osgi.core`/`osgi.done`. Split dependencies of maven publishing into core/all variants: `osgi.core` creates osgi bundles for just lib/reflect/comp.
| * | Support publishing to maven from main buildAdriaan Moors2013-10-221-100/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Publish to maven with `ant publish.local`, `ant publish`, or `ant publish.signed`. For now, we must keep copying `src/build/maven/maven-deploy.xml` to `dists/maven/latest.build.xml`, along with its dependencies, as it's used by jenkins jobs and PR validation. TODO: `inline src/build/maven/maven-deploy.xml` into `build.xml`.
| * | Inline src/build/pack.xml into build.xml.Adriaan Moors2013-10-211-263/+0
| | | | | | | | | | | | It tended too easily to get out of synch with build.xml.
| * | Correct license to 3-clause BSD in poms.Adriaan Moors2013-10-217-21/+14
| | |
* | | Merge pull request #3073 from retronym/ticket/7928Jason Zaugg2013-10-251-1/+5
|\ \ \ | | | | | | | | Favour module accessors symbols in rebind
| * | | SI-7928 Favour module accessors symbols in rebindJason Zaugg2013-10-231-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Refchecks tree transformer transforms a nested modules that overrides a method into a pair of symbols: the module itself, and an module accessor that matches the overridden symbol. [[syntax trees at end of typer]] // test1.scala package <empty> { abstract trait C2 extends scala.AnyRef { def O1: Any }; class C1 extends AnyRef with C2 { object O1 extends scala.AnyRef } } [[syntax trees at end of refchecks]] // test1.scala package <empty> { abstract trait C2 extends scala.AnyRef { def O1: Any }; class C1 extends AnyRef with C2 { object O1 extends scala.AnyRef @volatile <synthetic> private[this] var O1$module: C1.this.O1.type = _; <stable> def O1: C1.this.O1.type = { C1.this.O1$module = new C1.this.O1.type(); C1.this.O1$module } } } When constructing a TypeRef or SingleType with a prefix and and a symbol, the factory methods internally use `rebind` to see if the provided symbol should be replaced with an overriding symbol that is available in that prefix. Trying this out in the REPL is a bit misleading, because even if you change phase to `refchecks`, you won't get the desired results because the transform is not done in an InfoTransformer. scala> val O1 = typeOf[C1].decl(TermName("O1")) O1: $r.intp.global.Symbol = object O1 scala> typeRef(typeOf[C2], O1, Nil) res13: $r.intp.global.Type = C2#O1 scala> res13.asInstanceOf[TypeRef].sym.owner res14: $r.intp.global.Symbol = class C1 But debugging the test case, we get into `rebind` during an AsSeenFrom which is where we crashed when `suchThat` encountered the overloaded module and module accessor symbols: typeOf[OuterObject.Inner.type].memberType(symbolOf[InnerTrait.Collection]) ... singleTypeAsSeen(OuterTrait.this.Inner.type) val SingleType(pre, sym) = tp // pre = OuterTrait.this.type // sym = OuterTrait.Inner val pre1 = this(pre) // OuterObject.type singleType(pre1, sym) rebind(pre1, sym) // was crashing, now OuterObject.Inner } This commit excludes the module symbol from symbol lookup in the prefix in rebind.
* | | | Merge pull request #3079 from jamesward/fix/ec-implicit-errorJames Iry2013-10-251-1/+1
|\ \ \ \ | | | | | | | | | | More clear implicitNotFound error for ExecutionContext
| * | | | More clear implicitNotFound error for ExecutionContextJames Ward2013-10-241-1/+1
| | | | |
* | | | | Merge pull request #3077 from retronym/topic/phase-descAdriaan Moors2013-10-241-1/+1
|\ \ \ \ \ | | | | | | | | | | | | Update description of explicitouter phase.
| * | | | | Update description of explicitouter phase.Jason Zaugg2013-10-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Patern translation now happens earlier.
* | | | | | Merge pull request #3006 from ivmaykov/masterAdriaan Moors2013-10-241-0/+9
|\ \ \ \ \ \ | |_|/ / / / |/| | | | | SI-7883 - don't iterate over all keys in MapWrapper.containsKey()
| * | | | | SI-7883: Added a comment per CR feedback from @adriaanm, @IchoranIlya Maykov2013-10-031-0/+3
| | | | | |
| * | | | | SI-7883 - don't iterate over all keys in MapWrapper.containsKey()Ilya Maykov2013-10-011-0/+6
| | | | | |
* | | | | | Merge pull request #3074 from Jentsch/filterInDocsJason Zaugg2013-10-241-33/+38
|\ \ \ \ \ \ | |_|/ / / / |/| | | | | Prevent useless filter operation in docs
| * | | | | Prevent useless filter operation in docsJentsch2013-10-231-33/+38
| | | | | |
* | | | | | Merge pull request #3027 from etaty/patch-2Jason Zaugg2013-10-231-1/+1
|\ \ \ \ \ \ | |_|_|_|_|/ |/| | | | | IterableLike grouped : fix documentation
| * | | | | IterableLike.grouped() : More explicit documentationValerian2013-10-141-1/+1
| | | | | |
| * | | | | IterableLike grouped : fix documentationValerian2013-10-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | scala> Seq(1,2,3).grouped(2).toList res1: List[Seq[Int]] = List(List(1, 2), List(3))
* | | | | | Merge pull request #3059 from densh/pull/si-6840Jason Zaugg2013-10-232-2/+2
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-6840 fixes weird typing of quasiquote arguments
| * | | | | | SI-6840 fixes weird typing of quasiquote argumentsDen Shabalin2013-10-192-2/+2
| | |_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously quasiquote arguments were type checked against Any which caused weird inference that made splicing of complex expressions unusable: val l1 = List(q"foo") val l2 = List(q"bar") q"f(..${l1 ++ l2})" // argument type checked as Any instead of List[Tree] This is fixed by forcing compiler to type check against type variable which itself isn't used in any other way.
* | | | | | Merge pull request #3070 from xeno-by/topic/macro-impl-wrong-shapeJason Zaugg2013-10-232-8/+20
|\ \ \ \ \ \ | | | | | | | | | | | | | | better macro impl shape errors
| * | | | | | better macro impl shape errorsEugene Burmako2013-10-232-8/+20
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the advent of quasiquotes, we allowed both arguments and return types of macro impls to be c.Tree's (as opposed to traditional c.Expr[T]'s). This warrants an update of macro def <-> macro impl signature mismatch errors that include a printout of suggested macro impl signatures. Now along with a signature that contains exprs, we suggest another signature that has all exprs replaced by trees
* | | | | | Merge pull request #3068 from retronym/ticket/7020-3-1Jason Zaugg2013-10-232-8/+11
|\ \ \ \ \ \ | | | | | | | | | | | | | | Deterministic warnings for pattern matcher, take 2
| * | | | | | SI-7020 Deterministic warnings for pattern matcher, take 2Jason Zaugg2013-10-222-8/+11
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous swing at determinism, ebb01e05cbe4, made decent contact but apparently didn't hit it out of the park. The test wavered every hundred or so runs, as witnessed occasionally in nightly builds or pull request validation. I setup a test to run neg/7020.scala a few hundred times, and could trigger the failure reliably. I then swept through the pattern matcher in search of HashMap and HashSet creation, and changed them all to the Linked variety. The results of that are published in retronym#ticket/7020-3 [1]. This commit represents the careful whittling down of that patch to the minimal change required to exhibit determinism. [1] https://github.com/retronym/scala/compare/ticket/7020-3
* | | | | | Merge pull request #3057 from xeno-by/topic/fancy-java-classesJason Zaugg2013-10-233-31/+29
|\ \ \ \ \ \ | |_|_|_|_|/ |/| | | | | fixes handling of fancy nested classes in runtime reflection
| * | | | | fixes handling of fancy nested classes in runtime reflectionEugene Burmako2013-10-193-31/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replaces the `jclazz.isMemberClass` check for whether we have an inner/nested class with `jclazz.getEnclosingClass != null`, because there exist classes produced by javac (see the attached jar file and the test log) which have the following properties: * They are nested within a parent class * getEnclosingClass returns a non-null value * isMemberClass returns false Previously such classes were incorrectly treated as non-nested, were incorrectly put into an enclosing package rather than an enclosing class, and had their names trimmed in the process, leading to situations when a package has multiple declarations with the same name. This is now fixed. When changing the check, we need to be careful with interpretation of what Class.getEnclosingXXX methods return. If getEnclosingClass produces a non-null result, this doesn't mean that the class is inner or nested, because getEnclosingClass is also not null for local classes (the ones with getEnclosingMethod != null || getEnclosingConstructor != null). This is expressed in the order of pattern match clauses in `sOwner`. Now when the bug is fixed, I also revert b18a2f8798b2, restoring a very important integrity check in runtime reflection, which I had to disable a couple hours ago to fix a master breakage. More details at scala-internals: https://groups.google.com/forum/#!topic/scala-internals/hcnUFk75MgQ
* | | | | | Merge pull request #3047 from xeno-by/topic/deprecateEugene Burmako2013-10-225-1/+37
|\ \ \ \ \ \ | |_|/ / / / |/| | | | | deprecates raw tree manipulation facilities in macros.Context
| * | | | | deprecates raw tree manipulation facilities in macros.ContextEugene Burmako2013-10-185-1/+37
| | |_|/ / | |/| | |
* | | | | Merge pull request #3007 from densh/pull/fresh-name-and-package-supportEugene Burmako2013-10-1925-283/+463
|\ \ \ \ \ | |_|/ / / |/| | | | Add support for packages into quasiquotes and toolbox, improve handling of fresh names, unhardcode quasiquote expansion logic
| * | | | annotate return type of the implicit fresh name creatorDen Shabalin2013-10-181-2/+2
| | | | |
| * | | | use more descriptive types instead of ints in the parser and scannerDen Shabalin2013-10-182-82/+85
| | | | |
| * | | | use concurrent hash map with atomic integersDen Shabalin2013-10-182-11/+7
| | | | | | | | | | | | | | | | | | | | | | | | | This should ensure that concurrent access to the fresh name creator is properly synchronized.
| * | | | re-wire fresh name creator to currentUnit.fresh at compile-timeDen Shabalin2013-10-184-1/+5
| | | | |
| * | | | use NameTransformer.encode for fresh name prefix sanitizationDen Shabalin2013-10-181-2/+2
| | | | |
| * | | | eliminate isCaseDefEnd override by moving the logic into stock parserDen Shabalin2013-10-182-3/+1
| | | | |
| * | | | decrease duplication of fresh* function definitionsDen Shabalin2013-10-189-67/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit extracts out freshTermName and freshTypeName to the top-level with implicit fresh name creator argument. This will let to refactor out more methods out of tree builder into treegen that are dependent on fresh name generator. We also save quite a bit of boilerplate by not having to redefined fresh functions all over the place.
| * | | | move fresh name creator into scala.reflect.internal.utilDen Shabalin2013-10-185-56/+38
| | | | |
| * | | | rename selfdef into selfTypeDen Shabalin2013-10-182-27/+27
| | | | | | | | | | | | | | | | | | | | For sake of consistency with noSelfType.
| * | | | fix minor regression in quasiquote reificationDen Shabalin2013-10-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | emptyValDef should always be reified as emptyValDef. After the the introduction of SyntacticValDef this ceased to be true.
| * | | | better name for isCaseDefStartDen Shabalin2013-10-182-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As it was pointed out by @paulp current isCaseDefStart method's name doesn't really correspond to one of it's primary usages: checking if the block within case has reached it's end.
| * | | | make q"f(..$xs)" deconstruction symmetrical to q"f[..$xs]"Den Shabalin2013-10-184-0/+20
| | | | |
| * | | | advanced fresh name reificationDen Shabalin2013-10-186-6/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During parsing some names are generated artificially using freshTermName & freshTypeName (e.g. `x$1`). Such names should be reified in a different way because they are assumed to be always fresh and non-overlapping with the environment. So `x$1` should reify down to equivalent of `freshTermName("x$")` rather than `TermName("x$1")`. But this is not enough. One name can be used more than once in a tree. E.g. `q"_ + 1"` desugars into `q"x$1 => x$1 + 1"`. So we need to ensure that every place where `x$1` is used gets the same fresh name. Hence the need for `withFreshTermName` that lets q"_ + 1" quasiquote desugare into equivalent of `withFreshTermName("x$") { freshx => q"$freshx => $freshx + 1" }`. For pattern quasiquotes it's a bit different. Due to the fact that end-result must be a pattern we need to represent fresh names as patterns too. A natural way to express that something is fresh is to represent it as a free variable (e.g. any name will do in that place). But due to possible use of the same name in multiple places we need to make sure that all such places have the same values by adding a sequence of guards to the pattern. Previously such names were reified naively and it could have caused name collision problems and inability to properly much on trees that contain such names.