summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #929 from scalamacros/ticket/5895Adriaan Moors2012-07-2014-39/+86
|\ | | | | fixes field mirrors and also improves docs and exceptions for all mirrors
| * SI-5984 improves error reporting in JavaMirrorsEugene Burmako2012-07-1910-11/+49
| | | | | | | | | | | | | | | | | | | | Factors out error raising code and introduces a special exception class for Scala reflection errors. Also adds membership sanity checks to reflectXXX. Previously reflectField, reflectMethod, reflectClass and reflectModule in InstanceMirror didn't check that the symbols being passed to them actually correspond to some member of the related class.
| * SI-5895 fixes FieldMirrorsEugene Burmako2012-07-175-29/+38
| | | | | | | | | | | | | | reflectField now accepts getters and setters along with the field symbols, it also checks whether a field has a reasonable binary representation (this is necessary, because ctor parameters that are unused outside of their declaring constructors don't get compiled down to Java fields/methods).
* | Merge pull request #952 from adriaanm/ticket-4897Adriaan Moors2012-07-192-0/+11
|\ \ | | | | | | SI-4897 derive expected value from single type
| * | SI-4897 derive expected value from single typeAdriaan Moors2012-07-192-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | when the type in a type test is, say, `C.this.A.type`, must use the corresponding term `C.this.A` to test for equality if you use the naive REF(<C.this.A.type>.symbol), you'll get a path like `OwnerOfA.this.A`, where `OwnerOfA` might be a superclass of `C`, and explicitouter won't like that
* | | Merge pull request #947 from phaller/topic/sip14-critical-fixes-blockingAdriaan Moors2012-07-193-16/+19
|\ \ \ | | | | | | | | Critical bugfixes/leak fixes/API corrections + ScalaDoc for SIP-14
| * | | Critical bugfixes/leak fixes/API corrections + ScalaDoc for SIP-14Viktor Klang2012-07-193-16/+19
| | | |
* | | | Merge pull request #923 from scalamacros/ticket/6047Adriaan Moors2012-07-192-0/+21
|\ \ \ \ | |/ / / |/| | | test case closes SI-6047
| * | | test case closes SI-6047Eugene Burmako2012-07-172-0/+21
| | |/ | |/| | | | | | | The bug is not reproducible both in M4 and in M5.
* | | Merge pull request #919 from scalamacros/ticket/6086Adriaan Moors2012-07-1910-33/+117
|\ \ \ | |_|/ |/| | SI-6086 magic symbols strike back
| * | SI-6086 magic symbols strike backEugene Burmako2012-07-1710-33/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some of the symbols inside the compiler get created on the fly, because there are no physical entities in classfiles corresponding to them. This curious fact needs to be taken into account when loading symbols, so that the magic symbols get correctly loaded by reflective mirrors. magicSymbols (as defined in Definitions.scala) include not only top-level classes, but some other stuff (e.g. String_+ or methods on Any). Hence a filtering was done to exclude the stuff that's irrelevant to reflective symbol loading. Unfortunately a filter was configured to accept only _.isClass, which consequently ruled out scala.AnyRef (that is a type alias).
* | | Merge pull request #922 from dragos/issue/fix-SI-6092Adriaan Moors2012-07-192-0/+39
|\ \ \ | | | | | | | | SI-6092 don't leak in LazyAnnotationInfo, don't lift try{}finally{}
| * | | Fixed SI-6092. Fixed leaky annotations, and relaxed the conditions under ↵Iulian Dragos2012-07-182-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | which a try-catch is lifted out to an inner method. Less known fact: lazy values null-out their dependent values is their accessed only from their initializer. The analysis is not context-dependent (meaning the owner where a reference happens needs to be exactly that lazy value). * Removed no-op code around positions in `LazyAnnotationInfo` * Don't lift expressions that have no `catch` clause The two changes combined fix a memory leak that's been plaguing the IDE: an annotation (even when forced) would hang on to a namer, through the outer field of its call-by-name parameter. The test for the memory leak is in the IDE project (couldn't find a simple way to reproduce it outside the IDE), but there's a test checking that the field is null after initialization.
* | | | Merge pull request #939 from adriaanm/ticket-6089Adriaan Moors2012-07-192-0/+14
|\ \ \ \ | | | | | | | | | | SI-6089 better tail position analysis for matches
| * | | | SI-6089 better tail position analysis for matchesAdriaan Moors2012-07-182-0/+14
| | |_|/ | |/| | | | | | | | | | | | | | | | | | we mistakenly went into apply nodes to look for matchEnd-labeldefs in tail positions -- only apply nodes that jump to labels in tailpos should be traversed (this arises for nested matches)
* | | | Merge pull request #940 from axel22/issue/5937Adriaan Moors2012-07-181-0/+12
|\ \ \ \ | | | | | | | | | | SI-5937: Vector updated, +:, and :+ ignore provided builder, breaking type safety
| * | | | Fix SI-5937.Aleksandar Prokopec2012-07-181-0/+12
| | | | |
* | | | | Merge pull request #935 from scalamacros/ticket/5695Adriaan Moors2012-07-183-22/+0
|\ \ \ \ \ | | | | | | | | | | | | SI-5695 removes Context.enclosingApplication
| * | | | | SI-5695 removes Context.enclosingApplicationEugene Burmako2012-07-183-22/+0
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apparently it's impossible to find out the enclosing Apply node if you're an argument being typechecked (because the arguments are typechecked separately from the enclosing Apply). This functionality is by far not a core feature of macros, so I'm removing it.
* | | | | Merge pull request #909 from lrytz/t5892Adriaan Moors2012-07-183-0/+47
|\ \ \ \ \ | | | | | | | | | | | | SI-5892 allow implicit views in annotation args
| * | | | | SI-5892 allow implicit views in annotation argsLukas Rytz2012-07-183-0/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the problem was that lazy annotations got completed in phase pickler. the `inferView` method in Typers bails out if `isPastTyper`. now the lazy annotations completes `atPhase(typerPhase)`. test case in `pos`. the second test case in `neg` is for another bug that is discussed in a comment of SI-5892. when type checking arguments of type parameter annotations, the class members should not be in scope. this was alreay fixed in 9129cfe9.
* | | | | | Merge pull request #883 from dgruntz/issue/6061Adriaan Moors2012-07-182-11/+22
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-6061 adds weakly conformance for number types to resolveOverloaded
| * | | | | | SI-6061 adds weakly conformance for number types to resolveOverloadedDominik Gruntz2012-07-112-11/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fix changes resolveOverloaded in scala.reflect.internal so that numeric widening on the actual argument types is also considered for primitive number types. Needs changes in functions applicable and mostSpecific.
* | | | | | | Merge pull request #921 from adriaanm/ticket-spuriousnessAdriaan Moors2012-07-1820-0/+0
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | move test files that fail spuriously to pending
| * | | | | | | move test files that fail spuriously to pendingAdriaan Moors2012-07-1720-0/+0
| | |_|_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I have this sneaky suspicion that part of these spurious failures are caused by the recent partest optimizations. @axel22 already checked that compiler instances are not shared between test runs. However, except for the benchmark test, they all have a distinct race condition in symbol loading/type checking feel to them. Since, in the end, the tests and/or their corresponding fixes are as likely a culprit as the test framework, moving them out of the way until their owners can get them back in line and they stop throwing primate wenches into our build. We should bring them back as soon as possible, though.
* | | | | | | Merge pull request #933 from scalamacros/ticket/5731Adriaan Moors2012-07-1824-0/+72
|\ \ \ \ \ \ \ | |_|_|_|_|_|/ |/| | | | | | SI-5731 a few fixes for value classes
| * | | | | | SI-5731 a few fixes for value classesEugene Burmako2012-07-1724-0/+72
| | |_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've faced two gotchas. First of all posterasure, which is supposed to erase ErasedValueType types, didn't look into ConstantType.value that is known to be smuggling types (hi Paul that's a plus one). Secondly ClassManifest.classType[T] assumed that its T is bound by AnyRef, which is not the case for value types. Here I had two choices: a) introduce a special method for manifests of value types, b) remove the upper bound of the type parameter and call it a day. Since manifests are already deprecated and there's no difference which method was used to create which manifest, I went for option b).
* | | | | | Merge pull request #932 from hubertp/2.10.x-issue/5588Adriaan Moors2012-07-182-0/+16
|\ \ \ \ \ \ | |_|_|_|_|/ |/| | | | | Fixes SI-5588. Correct compare for Enumeration.
| * | | | | Fixes SI-5588. Correct compare for Enumeration.Hubert Plociniczak2012-07-172-0/+16
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | Slower than the original one but does comparison in the same spirit as IntOrdering. Review by @axel22.
* | | | | Merge pull request #904 from adriaanm/ticket-6077Adriaan Moors2012-07-172-0/+14
|\ \ \ \ \ | |/ / / / |/| | | | SI-6077 more conservative TreeMakersToConds for CSE
| * | | | SI-6077 more conservative TreeMakersToConds for CSEAdriaan Moors2012-07-142-0/+14
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | we were dropping irrefutable extractor calls (implemented for SI-4691) in common subcondition elimination, which caused bad code to be generated clean up TreeMakersToConds significantly in the process
* | | | Merge pull request #915 from gkossakowski/SI-6035-specialized-flagAdriaan Moors2012-07-173-0/+19
|\ \ \ \ | | | | | | | | | | SI-6035: Specialization and separate compilation.
| * | | | SI-6035: Specialization and separate compilation.Grzegorz Kossakowski2012-07-163-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix an issue when specialization wouldn't work properly in a setting where separate compilation was involved. E.g. if you inherit from a class that is specialized and has been compiled separately you might not get proper forwarders generated. A test-case that this commit adds covers that scenario. The root cause of this issue was the fact that SPECIALIZED flag was not pickled. Thanks to recent Flags reorganization (see a9b85db) all that needs to be done is to set the flag before pickling. We choose to that in superaccessors phase because it's a phase that runs before pickling and after type checking (so we can check if given symbol has an annotation). Removed old logic from uncurry that was responsible for setting flags that is not needed anymore because we set them in superaccessors. Review by @axel22 and @paulp.
* | | | | Merge pull request #910 from adriaanm/redo-847-ticket-6028Adriaan Moors2012-07-174-0/+112
|\ \ \ \ \ | |_|_|/ / |/| | | | SI-6028 Avoid needless symbol renaming in lambdalift
| * | | | SI-6028 Avoid needless symbol renaming in lambdalift.Jason Zaugg2012-07-144-10/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Preserve names of all referenced free vars. Only the proxy symbols have the fresh names. The resulting natural beauty is evident in the diff of t6028.check. This subsumes the treatment in 0e170e4b that ensured named parameter calls cannot see mangled names; pos/t6028 confirms as much.
| * | | | A test case that scrutinises lambdalifter's output.Jason Zaugg2012-07-142-0/+106
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | No doubt there are plenty of additional variations that could be added to exercise more code paths. This is the unflattering "before" photo; the next commit will make over the name mangling and reveal the simple beauty of unmangled names. References SI-6028
* | | | Merge pull request #913 from gkossakowski/partest-instrumentedAdriaan Moors2012-07-163-0/+33
|\ \ \ \ | | | | | | | | | | Partest: add `instrumented` test category.
| * | | | Partest: add `instrumented` test category.Grzegorz Kossakowski2012-07-163-0/+33
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | --- (taken from README) Tests in `instrumented/` directory are executed the same way as in `run/` but they have additional byte-code instrumentation performed for profiling. You should put your tests in `instrumented/` directory if you are interested in method call counts. Examples include tests for specialization (you want to count boxing and unboxing method calls) or high-level tests for optimizer where you are interested if methods are successfuly inlined (so they should not be called at runtime) or closures are eliminated (so no constructors of closures are called). Check `scala.tools.partest.instrumented.Instrumentation` to learn how to use the instrumentation infrastructure. The instrumentation itself is achieved by attaching a Java agent to the forked VM process that injects calls to profiler. Check `scala.tools.partest.javaagent.ProfilingAgent` for details. --- A few notes on low-level details of this change: * Partest now depends on asm library for byte-code instrumentation (`build.xml`) * Build additional jar called `scala-partest-javaagent.jar` that is used with `-javaagent:` option. (`build.xml`) * Set `-javaagent:` option for all tests in `instrumented/` directory. (`RunnerManger.scala`) * Introduce a new category of tests called `instrumented`. * Add one instrumented test to demonstrate usage and test new infrastructure itself. (`InstrumentationTest.scala`) Review by @phaller.
* | | | Merge pull request #876 from adriaanm/ticket-6011bAdriaan Moors2012-07-169-1/+83
|\ \ \ \ | | | | | | | | | | SI-6011 switches: unreachability, guard-free form
| * | | | SI-6011 switches: unreachability, guard-free formAdriaan Moors2012-07-169-1/+83
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A complete overhaul. The original implementation in SI-5830 (#821) was pretty buggy. [from the doc comment of `collapseGuardedCases`:] Collapse guarded cases that switch on the same constant (the last case may be unguarded). Cases with patterns A and B switch on the same constant iff for all values x that match A also match B and vice versa. (This roughly corresponds to equality on trees modulo alpha renaming and reordering of alternatives.) The rewrite only applies if some of the cases are guarded (this must be checked before invoking this method). The rewrite goes through the switch top-down and merges each case with the subsequent cases it is implied by (i.e. it matches if they match, not taking guards into account) If there are no unreachable cases, all cases can be uniquely assigned to a partition of such 'overlapping' cases, save for the default case (thus we jump to it rather than copying it several times). (The cases in a partition are implied by the principal element of the partition.) The overlapping cases are merged into one case with their guards pushed into the body as follows (with P the principal element of the overlapping patterns Pi): `{case Pi if(G_i) => B_i }*` is rewritten to `case P => {if(G_i) B_i}*` The rewrite fails (and returns Nil) when: (1) there is a subsequence of overlapping cases that has an unguarded case in the middle; only the last case of each subsequence of overlapping cases may be unguarded (this is implied by unreachability) (2) there are overlapping cases that differ (tested by `caseImpliedBy`) cases with patterns A and B are overlapping if for SOME value x, A matches x implies B matches y OR vice versa <-- note the difference with case equality defined above for example `case 'a' | 'b' =>` and `case 'b' =>` are different and overlapping (overlapping and equality disregard guards) Improved by @retronym's feedback in the following ways: - fix patternEquals (it's now quadratic, but correct) - update neg/t6011 to test the improved patternEquals - remove side-effect-in-condition ugliness - introduce isGuardedCase - docs & various code clarity Also closes SI-6048 (duplicate).
* | | | Merge pull request #897 from lrytz/t5956Adriaan Moors2012-07-163-5/+23
|\ \ \ \ | |/ / / |/| | | SI-5956 trigger copy generation with correct namer
| * | | SI-5956 trigger copy generation with correct namerLukas Rytz2012-07-133-5/+23
| | | | | | | | | | | | | | | | | | | | | | | | the call to `addCopyMethod` passes `templateNamer`, which is supposed to be the namer of the case class template. with two classes of the same name, `addCopyMethod` was triggered in the wrong template.
* | | | Merge pull request #902 from paulp/topic/name-implicitsAdriaan Moors2012-07-144-0/+35
|\ \ \ \ | |_|/ / |/| | | Implicits to encourage more Name-dropping.
| * | | Merge branch '2.10.x' into topic/name-implicitsPaul Phillips2012-07-1376-413/+1862
| |\ \ \ | | | |/ | | |/|
| * | | Implicits to encourage more Name-dropping.Paul Phillips2012-07-064-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This creates implicits in cakes across the land from: String => TermName String => TypeName And also from: Name => NameOps[Name] // lower priority TermName => NameOps[TermName] TypeName => NameOps[TypeName] What this is all about, using "drop" as a motivating example, is that these should all work: "abc" drop 1 // "bc": String ("abc": TermName) drop 1 // "bc": TermName ("abc": TypeName) drop 1 // "bc": TypeName (("abc": TypeName): Name) drop 1 // "bc": Name But this should not: ("bc": Name) // ambiguity error This requires drop not being directly on Name; peer implicits from String => TermName and String => TypeName; implicit classes to install drop on TermName and TypeName; and a lower priority implicit class to allow ops on Names. Review by @xeno.by .
* | | | SI-5957 enable direct parsing of nested java class classfileLukas Rytz2012-07-122-0/+17
| |_|/ |/| | | | | | | | by weakening an assertion. explained in the source comment.
* | | Merge pull request #874 from adriaanm/ticket-6022Adriaan Moors2012-07-112-0/+8
|\ \ \ | | | | | | | | SI-6022 model type-test-implication better
| * | | SI-6022 model type-test-implication betterAdriaan Moors2012-07-112-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | we use subtyping as a model for implication between instanceof tests i.e., when S <:< T we assume x.isInstanceOf[S] implies x.isInstanceOf[T] unfortunately this is not true in general. SI-6022 expects instanceOfTpImplies(ProductClass.tpe, AnyRefClass.tpe), but ProductClass.tpe <:< AnyRefClass.tpe does not hold because Product extends Any however, if x.isInstanceOf[Product] holds, so does x.isInstanceOf[AnyRef], and that's all we care about when modeling type tests
* | | | Merge branch '2.10.x' into topic/pickledflagsPaul Phillips2012-07-1130-43/+359
|\ \ \ \ | | |_|/ | |/| | | | | | | | | | Conflicts: src/reflect/scala/reflect/internal/Flags.scala
| | | |
| | \ \
| | \ \
| | \ \
| | \ \
| | \ \
| | \ \
| | \ \
| *-------. \ \ Merge commit 'refs/pull/825/head'; commit 'refs/pull/827/head'; commit ↵Adriaan Moors2012-07-1130-43/+359
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | 'refs/pull/828/head'; commit 'refs/pull/850/head'; commit 'refs/pull/858/head' into 2.10.x