summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Remove orphaned check files and flags files.Jason Zaugg2013-10-275-16/+0
| | | | (for f in $(find test -name '*.check' -o -name '*.flags'); do bare=$(echo $f | sed -E 's/\.\w+$//'); ([[ -f "$bare" ]] || [[ -d "$bare" ]] || [[ -f "$bare.scala" ]] || [[ -f "$bare.test" ]] || echo $f) done;) | xargs rm
* Remove empty check files and flags files.Jason Zaugg2013-10-2759-0/+0
| | | | for f in $(find test -name '*.check' -o -name '*.flags'); do [[ $(wc -c $f | sed -E 's/ *([0-9]+).*/\1/') == "0" ]] && rm $f; done
* Merge pull request #3073 from retronym/ticket/7928Jason Zaugg2013-10-251-0/+16
|\ | | | | Favour module accessors symbols in rebind
| * SI-7928 Favour module accessors symbols in rebindJason Zaugg2013-10-231-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 #3077 from retronym/topic/phase-descAdriaan Moors2013-10-245-5/+5
|\ \ | | | | | | Update description of explicitouter phase.
| * | Update description of explicitouter phase.Jason Zaugg2013-10-245-5/+5
| | | | | | | | | | | | Patern translation now happens earlier.
* | | Merge pull request #3006 from ivmaykov/masterAdriaan Moors2013-10-241-0/+49
|\ \ \ | |/ / |/| | SI-7883 - don't iterate over all keys in MapWrapper.containsKey()
| * | SI-7883 - don't iterate over all keys in MapWrapper.containsKey()Ilya Maykov2013-10-011-0/+49
| | |
* | | Merge pull request #3026 from retronym/ticket/3871Jason Zaugg2013-10-234-0/+242
|\ \ \ | | | | | | | | Tests for protected access
| * | | SI-3871 Testing protected access against the specJason Zaugg2013-10-232-0/+224
| | | | | | | | | | | | | | | | | | | | I've marked a few minor cases in the test with !!! where I believe the behaviour goes beyond the spec.
| * | | SI-3871 Missing test case for protected bug.Jason Zaugg2013-10-092-0/+18
| | | | | | | | | | | | | | | | c39f26382dddaa7 fixed the bug but didn't commit a test case.
* | | | Merge pull request #3039 from huitseeker/filter-partest-JAVA_OPTIONSJason Zaugg2013-10-231-0/+3
|\ \ \ \ | | | | | | | | | | Filter JVM debug output for custom options in partest
| * | | | Filter JVM debug output for custom options in partestFrançois Garillot2013-10-151-0/+3
| | | | | | | | | | | | | | | | | | | | The Picked up _JAVA_OPTIONS line occurs on Sun's JDK as a debug output when you use that variable to set up custom VM options
* | | | | Merge pull request #3059 from densh/pull/si-6840Jason Zaugg2013-10-231-0/+9
|\ \ \ \ \ | | | | | | | | | | | | SI-6840 fixes weird typing of quasiquote arguments
| * | | | | SI-6840 fixes weird typing of quasiquote argumentsDen Shabalin2013-10-191-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-238-1/+21
|\ \ \ \ \ \ | | | | | | | | | | | | | | better macro impl shape errors
| * | | | | | better macro impl shape errorsEugene Burmako2013-10-238-1/+21
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-233-4/+4
|\ \ \ \ \ \ | | | | | | | | | | | | | | Deterministic warnings for pattern matcher, take 2
| * | | | | | SI-7020 Deterministic warnings for pattern matcher, take 2Jason Zaugg2013-10-223-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 #3060 from harrah/t7519-bJason Zaugg2013-10-233-0/+28
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-7519: Additional test case covering sbt/sbt#914
| * | | | | | | SI-7519: Additional test case covering sbt/sbt#914Mark Harrah2013-10-203-0/+28
| | |/ / / / / | |/| | | | |
* | | | | | | Merge pull request #3057 from xeno-by/topic/fancy-java-classesJason Zaugg2013-10-233-0/+37
|\ \ \ \ \ \ \ | |_|_|_|_|_|/ |/| | | | | | fixes handling of fancy nested classes in runtime reflection
| * | | | | | fixes handling of fancy nested classes in runtime reflectionEugene Burmako2013-10-193-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | | | | temporarily disables run/reflection-sync-subtypesEugene Burmako2013-10-232-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This test has been a source of spurious failures as in, for example https://github.com/scala/scala/pull/3029#issuecomment-26811129, so I'm disabling it for the time being while I investigate the issue.
* | | | | | | Merge pull request #3047 from xeno-by/topic/deprecateEugene Burmako2013-10-2253-139/+149
|\ \ \ \ \ \ \ | |_|_|/ / / / |/| | | | | | deprecates raw tree manipulation facilities in macros.Context
| * | | | | | changes some manual tree constructions in macro tests to quasiquotesEugene Burmako2013-10-1834-100/+85
| | | | | | |
| * | | | | | deprecates raw tree manipulation facilities in macros.ContextEugene Burmako2013-10-1841-89/+114
| | | | | | |
* | | | | | | Moving disabled tests to their rightful home.Jason Zaugg2013-10-214-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | test/disabled, not test/files/disabled.
* | | | | | | Platform independence for SI-6240 test caseJason Zaugg2013-10-202-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | File.pathSeparator, rather than ":"
* | | | | | | hotfix for reflection tests on WindowsEugene Burmako2013-10-202-2/+0
| |_|/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removes the Unix-specific command-line sanity check put in place in recently committed reflection tests. On Windows, something like `C:\Java\jdk1.6.0_24-x64\jre\bin\java` might be a valid command (pointing to `java.exe` or `java.bat`) even if the eponymous file does not exist.
* | | | | | Merge pull request #3007 from densh/pull/fresh-name-and-package-supportEugene Burmako2013-10-1912-15/+136
|\ \ \ \ \ \ | | | | | | | | | | | | | | Add support for packages into quasiquotes and toolbox, improve handling of fresh names, unhardcode quasiquote expansion logic
| * | | | | | use concurrent hash map with atomic integersDen Shabalin2013-10-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-181-0/+2
| | | | | | |
| * | | | | | eliminate isCaseDefEnd override by moving the logic into stock parserDen Shabalin2013-10-181-1/+1
| | | | | | |
| * | | | | | make q"f(..$xs)" deconstruction symmetrical to q"f[..$xs]"Den Shabalin2013-10-181-3/+2
| | | | | | |
| * | | | | | advanced fresh name reificationDen Shabalin2013-10-182-2/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | | | | use regular macro expansion logic for unapply quasiquotesDen Shabalin2013-10-141-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously due to limited support for expansion in apply position quasiquotes had to use a compiler hook for deconstruction. Now with recent changes in pattern matcher it's possible to remove that special case.
| * | | | | | minor changes due to typosDen Shabalin2013-10-141-1/+1
| | | | | | |
| * | | | | | SI-6841 SI-6657 add support for packages into quasiquotes and toolboxDen Shabalin2013-10-145-2/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to implement this a new parser entry point `parseStatsOrPackages` that augments current parseStats with ability to parse "package name { ... }" syntax.
| * | | | | | harden test case to avoid parsing failure when name is keywordDen Shabalin2013-10-141-1/+3
| | | | | | |
* | | | | | | Merge pull request #3051 from retronym/merge/2.10.x-to-master-4Grzegorz Kossakowski2013-10-198-0/+0
|\ \ \ \ \ \ \ | |_|_|/ / / / |/| | | | | | Merge 2.10.x to master (again)
| * | | | | | Merge remote-tracking branch 'origin/2.10.x' into merge/2.10.x-to-master-4Jason Zaugg2013-10-188-0/+0
| |\ \ \ \ \ \
| | * | | | | | Disable tests for SI-7020Jason Zaugg2013-10-173-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are still impudently being non-deterministic. I've reopened the ticket so we can take another swing at it. A well targetted s/HashMap/LinkedHashMap/ will almost certainly be the salve. fail - neg/t7020.scala [output differs]% scalac t7020.scala 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((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(??, _), List(_, _) List(5) match { ^ 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((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(??, _), List(_, _) List(5) match { ^
| | * | | | | | Disable flaky presentation compiler test.Jason Zaugg2013-10-175-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Francois is investigating the root cause as part of his work on stabilizing Scaladoc preview in the IDE. The test seems to only fail on the windows nightly build. I suspect this is due to a slower or loaded machine.
* | | | | | | | pull request feedbackEugene Burmako2013-10-184-2002/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://github.com/scala/scala/pull/3029
* | | | | | | | runtime reflection: death from thousand threadsEugene Burmako2013-10-184-0/+2051
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | not anymore
* | | | | | | | SI-7045 reflection now auto-initializes selfTypeEugene Burmako2013-10-182-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | selfType joins the happy family of flags, annotations and privateWithin, which automatically trigger initialization, when used within runtime reflection.
* | | | | | | | optimizes Scala reflection GILEugene Burmako2013-10-181-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First of all, GIL should only apply to runtime reflection, because noone is going to run toolboxes in multiple threads: a) that's impossible, b/c the compiler isn't thread safe, b) ToolBox api prevents that. Secondly, the only things in symbols which require synchronization are: 1) info/validTo (completers aren't thread-safe), 2) rawInfo and its dependencies (it shares a mutable field with info) 3) non-trivial caches like in typeAsMemberOfLock If you think about it, other things like sourceModule or associatedFile don't need synchronization, because they are either set up when a symbol is created or cloned or when it's completed. The former is obviously safe, while the latter is safe as well, because before acquiring init-dependent state of symbols, the compiler calls `initialize`, which is synchronized. We can say that symbols can be in four possible states: 1) being created, 2) created, but not yet initialized, 3) initializing, 4) initialized. Of those only #3 is dangerous and needs protection, which is what this commit does.
* | | | | | | | tests for fancy classloader configurationsEugene Burmako2013-10-189-0/+137
| | | | | | | |
* | | | | | | | eagerly initializes lazy vals and objects in runtime reflectionJason Zaugg2013-10-181-0/+82
| |_|_|/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code to do so is curated with the help of a generator. Because this needs to inspect code post-typer, the code generator is run during partest as a code-validator. We could concievably do the same with a macro, but this approach might be a better starting point which macros continue to stabilize. Removes Definitions.AnyRefModule and an already deprecated alias, as these have been throwing exceptions for more than a year since 6bb5975289. They used to be used by AnyRef specialization.