summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Disables typechecking that precedes reflective compilationEugene Burmako2012-02-14103-181/+180
| | | | | | | | | | | | | | Previously toolboxes used to typecheck their inputs before compiling. Actually, the initial demo by Martin first typechecked the reified tree, then ran it, which typechecked it again, and only then launched the reflective compiler. However, as observed in https://issues.scala-lang.org/browse/SI-5464 current implementation of typechecking is not always idempotent. That's why we cannot allow inputs of toolboxes to be typechecked, at least not until the aforementioned issue is closed. This is not only a convention but also a check inside compileExpr.
* Preprocessing for reifeesEugene Burmako2012-02-1423-2/+105
|
* Make fix for SI-5452 not break other things.Paul Phillips2012-02-141-1/+3
| | | | If this looks hacky, that's because it is.
* Fix for SI-5452.Paul Phillips2012-02-132-0/+35
| | | | | | | | | | | | | Why is calling the error function not enough to register the error, why does "setError(tree)" have to be called as well? That was the cause of this particular stackoverflow. In ContextErrors I see lots of methods which call setError and lots more which do not, and frankly it's all pretty terrifying. There is zero documentation attached to setError. Maybe there's an explanation somewhere I'm not seeing. Review by @hubertp.
* Fix for SI-5444.Paul Phillips2012-02-131-0/+42
| | | | | Fix for trait/impl renaming in 5cbd7d06eb was incomplete. Looks more complete now.
* Merge branch 'master' into developPaul Phillips2012-02-132-0/+239
|\
| * Existential printing, plus more compiler testing infrastructure.Paul Phillips2012-02-132-0/+239
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Direct compiler internals testing. It's really easy, you should probably use it about 1000 times each. Look at the test: run/existentials-in-compiler.scala The checkfile contains the (string representations of the) actual existentials from the compiler to make sure they correspond properly to the ones in the source. Existentials were being printed with wildcards too freely; this has been tightened up.
* | Merge remote-tracking branches 'scalamacros/pullrequest/5453' and ↵Paul Phillips2012-02-1315-1/+92
|\ \ | | | | | | | | | 'scalamacros/pullrequest/5229' into develop
| * | Fixes https://issues.scala-lang.org/browse/SI-5229Eugene Burmako2012-02-1415-1/+92
| |/
* / Fixes https://issues.scala-lang.org/browse/SI-5453Eugene Burmako2012-02-131-1/+1
|/ | | | | | | | | | | Originally we thought that macros declared inside objects should not provide _this to their bodies. However, it: 1) contradicts vanilla Scala rules, according to which both class and object methods can use this, 2) imposes unnecessary burden on macro developers without providing any conveniences to us. Review by @odersky.
* reifyAnnotationsEugene Burmako2012-02-1225-34/+304
| | | | | | | | | | | | | | | | | | | | | | | Annotations are now supported by the reifier: * AnnotationInfos from symbols get transformed back into mods. * AnnotatedTypes are retained and are reified along with AnnotationInfos. Reification is no magic, and reification of annotations especially: * Annotations cannot refer to symbols defined inside the quasiquote. This restriction is due to the fact that we need to erase locally defined symbols before reifying to make subsequent reflective compilations succeed. However, while doing that, we also need to make sure that we don't make resulting ASTs non-compilable by removing essential information. This is tricky, and it more or less works for TypeTrees, but not for annotations that can contain arbitrary ASTs. For more details look into the comments to Reifiers.scala. * Classfile annotations that contain array arguments and are applied to types, i.e. the ones that generate AnnotatedTypes, cannot be reified. This is because of limitations of manifest infrastructure. Typechecking "Array(mirror.LiteralAnnotArg(...))" would require the compiler to produce a manifest for a path-dependent type, which cannot be done now. Review by @odersky.
* Updated existentials test with non-working parts.Paul Phillips2012-02-121-0/+13
| | | | | | | | | | | | | | Lazy accessors have the same essential problem as described in recent commit messages, so this still doesn't work: def f() = { case class Bob(); Bob } ; lazy val g = f On the whole I'm trying to solve this at the wrong level. The derived accessor methods and fields of a declaration should not ever wander far enough apart that there is any challenge in reconciling them. (The same is true for case classes/objects.) They're dependent synthetics who know about one another from the beginning, all we have to do is not forget. In the meantime, test case.
* Fix for overly suppressive repl.Paul Phillips2012-02-121-0/+3
| | | | | | | | | At some point in the past, trying to prevent deprection warnings from being issue in triplicate in the repl, I suppressed too much output, leading to a class of breakdowns where the failure would be swallowed completely. This went on for far too long. The deprecation warnings are back in triplicate for the moment, but the repl should now be less "strong, silent type" and more emo.
* Another existential problem down.Paul Phillips2012-02-119-95/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a window of danger when multiple related elements are being typed where something which is conceptually one thing can slip into two things, and those two things can be incompatible with one another. Less mysteriously, c478eb770d fixed this: def f = { object Bob ; Bob } ; val g = f But, it did not fix this: def f = { case class Bob() ; Bob } ; val g = f See test case pos/existentials-harmful.scala for an "in the wild" code example fixed by this commit. The root of the problem was that the getter and the field would each independently derive the same existential type to describe Bob, but those existentials were not the same as one another. This has been the most elusive bug I have ever fixed. I want to cry when I think of how much time I've put into it over the past half decade or so. Unfortunately the way the repl works it is particularly good at eliciting those grotesque found/required error messages and so I was never able to let the thing go. There is still a cosmetic issue (from the last commit really) where compound types wind up with repeated parents. Closes SI-1195, SI-1201.
* Overcame long-maddening existential issue.Paul Phillips2012-02-104-0/+108
| | | | | | | | | | | | | | | | | When performing an existential transform, the bounds produced by the hidden symbols may contain references to the hidden symbols, but these references were not accounted for. This was at the root of some bad behavior with existentials. If you've ever seen a message like this: <console>:8: error: type mismatch; found : B(in value res0) where type B(in value res0) <: A with ScalaObject required: B(in value res0) forSome { type B(in value res0) <: A with ScalaObject; type A <: Object with ScalaObject } ...then you know what I mean. Closes SI-4171, not quite yet on SI-1195, SI-1201.
* Failing tests for pending.Paul Phillips2012-02-103-0/+43
|
* Scaladoc @usecase annotation overriding / SI-5287Vlad Ureche2012-02-063-34/+253
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From now on, the usecases inherit the comments from their parents, such as the explanation and the annotations: @param, @tparam, @return, etc. An example of usecase comment inheritance is: /** * The test function tests the parameter param for ... * * @param theParam the implicit parameter to be tested for ... * @return the result of the test * * * * @usecase def test(): Bool * * The test function tests the parameter taken implicitly from scope. * Example: `test()` * * @return the result of the test for the current scope * * * * @usecase def test(theParam: SomeType): Bool * * This takes the explicit value passed. * Example: `test(3)` * * @param theParam the explicit parameter to be tested for ... */ def test(implicit theParam: SomeType): Bool Notice both usecases override the explanation with their own examples. The first usecase also overrides the "@return" annotation while the 2nd usecase overrides the "@param theParam" annotation. If they didn't override the explanations and annotations, they would inherit the values from the actual implementation, def test(implicit ...) This will be followed by @inheritdoc, which enables more fine-grained control over comment inheritance. The full explanation of using comment inheritance and @inheritdoc and their interaction with variables is given at https://wiki.scala-lang.org/display/SW/Tags+and+Annotations in the "Comment inheritance" and "Inheritance Example" sections.
* Merge branch 'master' into feature/pc-ctrieAleksandar Prokopec2012-02-06133-197/+699
|\
| * Revert "Scaladoc @usecase annotation overriding / SI-5287"Paul Phillips2012-02-053-253/+34
| | | | | | | | This reverts commit 7946ac410ad74894cd0eb6dfd29447f173911b99.
| * Refining the reflection api.Paul Phillips2012-02-052-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the pursuit of simplicity and consistency. - Method names like getType, getClass, and getValue are far too ambiguous, both internally and especially with java reflection names. Methods which accept or return scala symbols should not refer to them as "classes" in the reflection library. (We can live with the FooClass convention for naming the well-known symbols, it's names like "getClass" and "classToType" which are needlessly conflationary.) - Meaningless names like "subst" have to be expanded. - We should hew closely to the terms which are used by scala programmers wherever possible, thus using "thisType" to mean "C.this" can only beget confusion, given that "thisType" doesn't mean "this.type" but what is normally called the "self type." - It's either "enclosing" or "encl", not both, and similar consistency issues. - Eliminated getAnnotations. - Removed what I could get away with from the API; would like to push those which are presently justified as being "required for LiftCode" out of the core. - Changed a number of AnyRefs to Any both on general principles and because before long it may actually matter. - There are !!!s scattered all over this commit, mostly where I think the name could be better. - I think we should standardize on method names like "vmSignature, vmClass" etc. when we are talking about jvm (and ostensibly other vm) things. There are a bunch more places to make this distinction clear (e.g. Symbol's javaBinaryName, etc.) - There is a lot more I want to do on this and I don't know where the time will come from to do it. Review by @odersky, @scalamacros.
| *-----. Merge remote-tracking branches 'VladUreche/feature/compiler-rootdoc', ↵Paul Phillips2012-02-0512-39/+281
| |\ \ \ \ | | | | | | | | | | | | | | | | | | 'scalamacros/pullrequest/5334', 'scalamacros/pullrequest/5272' and 'VladUreche/issue/5287-cleanup' into develop
| | | | | * Scaladoc @usecase annotation overriding / SI-5287Vlad Ureche2012-02-053-34/+253
| | | |_|/ | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From now on, the usecases inherit the comments from their parents, such as the explanation and the annotations: @param, @tparam, @return, etc. An example of usecase comment inheritance is: /** * The test function tests the parameter param for ... * * @param theParam the implicit parameter to be tested for ... * @return the result of the test * * * * @usecase def test(): Bool * * The test function tests the parameter taken implicitly from scope. * Example: `test()` * * @return the result of the test for the current scope * * * * @usecase def test(theParam: SomeType): Bool * * This takes the explicit value passed. * Example: `test(3)` * * @param theParam the explicit parameter to be tested for ... */ def test(implicit theParam: SomeType): Bool Notice both usecases override the explanation with their own examples. The first usecase also overrides the "@return" annotation while the 2nd usecase overrides the "@param theParam" annotation. If they didn't override the explanations and annotations, they would inherit the values from the actual implementation, def test(implicit ...) This will be followed by @inheritdoc, which enables more fine-grained control over comment inheritance. The full explanation of using comment inheritance and @inheritdoc and their interaction with variables is given at https://wiki.scala-lang.org/display/SW/Tags+and+Annotations in the "Comment inheritance" and "Inheritance Example" sections.
| | | | * Fixes https://issues.scala-lang.org/browse/SI-5272Eugene Burmako2012-02-055-1/+18
| | |_|/ | |/| |
| | | * Fixes https://issues.scala-lang.org/browse/SI-5334Eugene Burmako2012-02-054-4/+10
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | New version of reification isn't susceptible to this bug. The problem was with Code.lift generating not only a tree, but also a manifest with the type of that tree. That led to an issue in the case of the type of the manifest depending on a class declared inside the quasiquote. Now manifests in reification are gone, so is the problem.
| * | Replaced LiftCode with a function in MacroContextEugene Burmako2012-02-0520-171/+46
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | Major cleanup of reification: * LiftCode phase has been removed * Code has been deprecated and will be removed as we roll a new starr * Logic related to type-directed lifting has been purged scala.reflect.macro.Context#reify now provides the same services as LiftCode provided (except that it returns Tree, not Code). For testing purposes, I've retained the oh-so-convenient automagic lift. test/files/codelib/code.jar now hosts Code.lift reimplemented in a macro, so that the tests can continue working as if nothing has happened.
| * Updated Flags toString/documentation.Paul Phillips2012-02-028-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | In a stunningly unusual demonstration of farsightedness, I was able to generate these changes only by running: scala scala.tools.nsc.util.FlagsUtilCompiler With this much time in between runs: -// Generated by mkFlagsTable() at Mon Oct 11 10:01:09 PDT 2010 +// Generated by mkFlagsTable() at Thu Feb 02 20:31:52 PST 2012
| * Merge commit 'c58b240' into developPaul Phillips2012-02-023-0/+54
| |\
| | * [vpm] __match determines match semantics; virtualizationAdriaan Moors2012-02-023-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | determine match strategy by typing `__match` factored out the interface to generate code in this monad, cleaned up codegen a bit no longer solving a context bound to determine the match strategy and the monad's type constructor it's too expensive don't consider implicits looking for __match implicit search causes HUGE slowdowns -- now the overhead is about 4% compared to just assuming there's no __match in scope to support virtualization&staging, we use the type of `__match.one` as the prototype for how to wrap "pure" types and types "in the monad" pure types T are wrapped as P[T], and T goes into the monad as M[T], if one is defined as: def one[T](x: P[T]): M[T] for staging, P will typically be the Rep type constructor, and type M[T] = Rep[Option[T]] furthermore, naive codegen no longer supplies type information -- type inference will have to work it out optimized codegen still does, of course, and that's enough since we only bootstrap that way TODO: improve the test (currently the condition is not represented)
| * | Fixes reifyThisEugene Burmako2012-02-0230-2/+2
| | |
| * | Miscellaneous fixes to reificationEugene Burmako2012-02-0243-2/+269
| |/ | | | | | | | | | | | | | | More specifically: * Importers now preserve wasEmpty and original * ToolBoxes no longer auto-evaluate nullary functions returned by runExpr * All local symbols from previous typechecks are now correctly erased by ResetAttrs * Originals are now reified
| *-. Merge remote-tracking branches 'scalamacros/pullrequest/5258' and ↵Paul Phillips2012-02-0122-0/+169
| |\ \ | | | | | | | | | | | | 'scalamacros/pullrequest/5256' into develop
| | | * Hardens classToType logicEugene Burmako2012-02-0116-0/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reflection now correctly processes classes, objects and inner classes that are declared in classes and objects. However classToType still crashes on compound types and local classes. For more information on those, follow the links: * Compound types: https://issues.scala-lang.org/browse/SI-5430 * Local classes: https://issues.scala-lang.org/browse/SI-5431 Fixes https://issues.scala-lang.org/browse/SI-5256. Review by @paulp, @odersky.
| | * | Hardens reification against rare kinds of ConstantsEugene Burmako2012-02-016-0/+47
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | Importers now correctly process constants that carry types and symbols. However, it is still impossible to reify classOf for a class/trait that is defined inside a quasiquote. Theoretically, this can be implemented, but will require attaching original trees to classOf constants, which needs much more effort.
| * / Fix for parser OOM.Paul Phillips2012-02-012-0/+6
| |/ | | | | | | | | | | | | | | | | | | | | | | The scanner performs some sketchy heuristics when it sees an ascii 1A since it may be EOF or it may be part of a literal. Due to this, it failed to detect an unterminated string literal if the opening quote was unicode-escaped, leading to memory exhaustion as it read SUs until the universe ended. We're parsing a fixed input with known length! There's no reason to be guessing about whether a char is EOF. If we're at the end of the file, it's the end of file. Otherwise, it is not the end of the file.
| *---. Merge remote-tracking branches 'gkossakowski/virtpatmat-switch', ↵Paul Phillips2012-02-0113-0/+102
| |\ \ \ | | | | | | | | | | | | | | | 'scalamacros/pullrequest/5427' and 'scalamacros/pullrequest/5423' into develop
| | | | * Introduce getAnnotations that triggers symbol completionEugene Burmako2012-01-312-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Default getter for annotations doesn't perform initialization, hence we've faced the following bug: https://issues.scala-lang.org/browse/SI-5423. One of the approaches to fixing it would be to auto-complete on getter, but according to Martin we'd better not do that because of cycles. That's why I'm just introducing a new, eager, variation of `annotations' and redirecting public API to it. Review by @odersky.
| | | * | Tests for https://issues.scala-lang.org/browse/SI-5427Eugene Burmako2012-02-018-0/+49
| | | |/
| | * | Added a test-case for switches with Yvirtpatmat.Grzegorz Kossakowski2012-02-013-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added a bunch of tests that cover changes related to switches that were applied to Yvirtpatmat implementation. Note: I didn't add those tests progressively because my changes fix trees after typer phase but do not affect resulting bytecode. How come? It's because -Yvirtpatmat will emit pattern for switches and then the old pattern matcher implementation would transform them in the old fashion in explicitouter. We cannot disable the old pattern matcher in explicitouter yet because it doesn't handle patterns used for catching exceptions. Thus, consider this as a sign of the fact that Yvirtpatmat is still work in progress.
| * | | Fix for slice boundary condition.Paul Phillips2012-02-012-0/+6
| |/ / | | | | | | | | | | | | Negative "to" index should be normalized to 0 before using it in a difference operation.
* | | Add tests for parallel Ctrie.Aleksandar Prokopec2012-02-036-16/+126
| | | | | | | | | | | | Changed parameters in some tests to speed them up.
* | | Fix some issues in parallel Ctrie.Aleksandar Prokopec2012-02-032-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change resolves some issues with ParCtrie splitters and their `remaining` method, which currently evaluates the size of the Ctrie. Since this is still not done lazily, nor in parallel, it has a certain cost, which is unacceptable. Change #1: The `shouldSplitFurther` method is by default implemented by calling the `remaining` method. This method now forwards the call to the same method in the splitter which is by default implemented in the same way as before, but can be overridden by custom collections such as the ParCtrie. Change #2: ParCtrie splitter now has a `level` member which just counts how many times the method has been split. This information is used to override the default `shouldSplitFurther` implementation. Change #3: The tasks and splitters rely heavily on the `remaining` method in the splitter for most operations. There is an additional method called `isRemainingCheap` which returns true by default, but can be overridden by custom collections such as the `Ctrie`.
* | | Incorporate Ctrie into standard library.Aleksandar Prokopec2012-02-023-2/+14
| | | | | | | | | | | | Implemented Ctrie serialization. Improved hashcode computation.
* | | Add the Ctrie concurrent map implementation.Aleksandar Prokopec2012-02-018-0/+1040
|/ / | | | | | | | | | | | | | | | | | | | | | | | | Ctrie is a scalable concurrent map implementation that supports constant time lock-free lazy snapshots. Due to the well-known private volatile field problem, atomic reference updaters cannot be used efficiently in Scala yet. For this reason, 4 java files had to be included as well. None of these pollute the namespace, as most of the classes are private. Unit tests and a scalacheck check is also included.
* | Test case closes SI-5352.Paul Phillips2012-01-313-0/+29
| |
* | Improved warning for insensible comparisons.Paul Phillips2012-01-314-1/+28
|/ | | | | Utilize knowledge of case class synthetic equals to rule out some comparisons statically. Closes SI-5426.
*-. Merge remote-tracking branches 'axel22/issue/4147', 'axel22/issue/5374' and ↵Paul Phillips2012-01-301-0/+19
|\ \ | | | | | | | | | 'hubertp/ticket/4336' into develop
| | * Closes #4336.Hubert Plociniczak2012-01-301-0/+19
| |/ | | | | | | Some of the type params might already be instantiated if explicit type application is done. Review by @adriaanm
* | Fixed the benchmarks a bit.aleksandar2012-01-303-18/+27
| |
* | Merge pull request #1 from lpereir4/avlAleksandar Prokopec2012-01-306-0/+442
|\ \ | |/ |/| AvlTree performance improvements
| * Scalacheck test in order to ensure AVL invariants are respected.Lucien Pereira2012-01-281-0/+114
| |