aboutsummaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Handling higher-kinded types with lambdasMartin Odersky2014-06-181-2/+1
| | | | | Switch to the new scheme where higher-kinded types (and also some polymorphic type aliases) are represented as instances of Lambda traits.
* Change definition of isLegalPrefix so that it allows projecting on an ↵Martin Odersky2014-06-121-0/+1
| | | | | | | | | | | | | | abstract type. This is needed to make the encoding og higher-kinded types work. E.g. Rep[Int] would be represented as Rep { type Arg$0 = Int } # Apply where Apply is an abstract member of the base class Lambfa$I of Rep.
* Reclassifying testsMartin Odersky2014-05-301-0/+1
|
* Merge pull request #132 from DarkDimius/small-fixesDmitry Petrashko2014-05-201-20/+20
|\ | | | | Small fixes
| * Fix too precise type error in LazyVals.Dmitry Petrashko2014-05-091-20/+20
| |
* | reduce test verbosity to get below 10K lines of test outputSamuel Gruetter2014-05-201-2/+2
| | | | | | | | becaus this is the limit imposed by Travis
* | Make java file compile under 1.6.Martin Odersky2014-05-201-2/+2
| | | | | | | | I still have 1.6 installed. So the two simple fixes are necessary to make my build pass for now.
* | More systematic treatment of prototypes.Martin Odersky2014-05-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's a delicate balance about how much of a prototype should be passed down the tree when typechecking. Passing little can cause ambiguity errors (both in overloading and in implicit search). Passing too much can cause spurious errors because implicit conversions "down the road" that apply to some tree continaing the result might not be considered. Symptoms of the problems wree that we could not handle the tests included in this commit before. The new scheme is as follows: we always keep all available information in a prototype, but hide nested prototypes behined a `IgnoredProto` wall. These trees will not be considered for conformity checking. When type checking hits an ambiguity, it tries again with a prototype that's one level deeper (has fewer Ignore links) than the previous one. This continues until there are no more Ignore links to unwrap. We also generalize the scheme for wrapping qualifiers of select nodes from realApply to all instances where we compare against a FunProto. Finally, there are some fixes that avoid assertion violations that were provoked by the new typechecking scheme.
* | Pos tests t17xx - t19xxMartin Odersky2014-05-201-0/+1
| |
* | Reporter refactoringMartin Odersky2014-05-201-1/+1
|/ | | | Refactored reporters to increase clarity and to pave the way for having Diagnostics subclasses.
* Fix lazy vals test broken by fixing fixing tpd.ClassDef.Dmitry Petrashko2014-05-081-11/+12
|
* Added compliing dotc/transform to testsMartin Odersky2014-05-081-1/+2
| | | | With the previous fixes, we can now compile dotc/transform without errors.
* Changes to test framework and testsMartin Odersky2014-05-083-15/+19
| | | | | | | | | defaultOptions is now an implicit parameter, which means it can be overridden on a call-by-call basis. Added -Ycheck:front to verify that typed trees typecheck again with same types. The option is disabled for one of the structural tests.
* Moved tests to pending because they fail -Ycheck:frontMartin Odersky2014-05-081-1/+1
|
* Removing duplication between Any and Object methodsMartin Odersky2014-05-081-1/+1
| | | | | | | | | | | | | | | | | | | | We cannot have same named methods defined in Object and Any because after erasure the Any references get remapped to the Object methods which would result in a double binding assertion failure. Instead we do the following: - Have some methods exist only in Any, and remap them with the Erasure denotation transformer to be owned by Object. - Have other methods exist only in Object. To achieve this, we synthesize all Any and Object methods; Objetc methods no longer get loaded from a classfile. There's a complication with getClass. We need to reconsider what the best treatment of getClass is. Right now there's too much magic going on for my taste. It might be better to leave getClass on Object only as it is in Java, forget about the special treatement of its type, and have another getClass like method in an decorator on class Any. That could produce the right types and could also work for primitive types.
* Merge pull request #119 from DarkDimius/leaksDmitry Petrashko2014-05-064-3/+156
|\ | | | | Context escape detection.
| * Allow to provide parent Context for Driver.processDmitry Petrashko2014-04-111-1/+1
| |
| * Context escape detection.Dmitry Petrashko2014-04-093-2/+155
| | | | | | | | | | | | | | During creation of each of DottyTests context is stolen from test and a WeakReference for it is created. After running all tests references are examined to detect if any of them has leaked.
* | New phase: NullarifyMartin Odersky2014-04-151-2/+1
| | | | | | | | Eliminates ExprTypes and PolyTypes over value types.
* | TailRec phase and tests for it.Dmitry Petrashko2014-04-111-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ported tailcall phase from scalac with such changes: - all transformation is done in the phase itself (previously half of the work was done in backend) - it is now able to run before uncurry - it is now a treeTransform - renamed to tailrec to make it more obvious that this phase transforms only recursive calls. For now this is a single phase which speculatively transforms DefDefs. Speculation can be potentially removed by splitting into 2 phases: one detecting which methods should be transformed second performing transformation. But, as transformation requires as same amount of work as detection, I believe it will be simpler to maintain it as a single phase. Conflicts: tests/pos/typers.scala
* | Merge pull request #118 from dotty-staging/fix/annotationsDmitry Petrashko2014-04-091-9/+10
|\ \ | |/ |/| Fixing annotations
| * Fix lazy vals tests broken by previous commit.Dmitry Petrashko2014-04-091-9/+10
| |
* | Option for testing for double bindingsMartin Odersky2014-04-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A double binding is if a named type gets assigned two denotations in the same period. This is a side-effect and also a race condition, so it's very bad. I am trying to eliminate all causes of this. But one cause which will likely remain are double defitions in a prgram, if a user writes class C { val x: Int val x: Int } Then it's really hard to avoid setting two meanings of C.this.x! That's why the testing against double bindings is enabled by a -YnoDoubleBindings option. The understanding is that -YnoDoubleBindings should be set only if there are no double def errors anticipated. Otherwise the program might fail with an assertion error before the double def error is reported.
* | Fleshed out Splitter phaseMartin Odersky2014-04-081-0/+2
|/ | | | | | | Implemented splitting operations As a side effect, this contains a test ruling out structural term member dispatch. Tests 0586 and 0625 which used structural dispatch got moved to neg.
* Reduce verbosity of logs.Dmitry Petrashko2014-04-023-5/+3
| | | | | | | | | | We are already over limit on output size imposed by travis that is shown in webpage, if we'll continue to add tests will be soon over limit even to run builds. This commit disables printing of classpath, and removes printlns in several places. In order for ShowClassTests to print info as is was printing previously, please set "test.ShowClassTests.verbose" property.
* Fix error in lazy-vals.Dmitry Petrashko2014-03-311-1/+1
| | | | Wrong helper method was used.
* Merge pull request #102 from dotty-staging/transform/erasureDmitry Petrashko2014-03-311-26/+28
|\ | | | | Transform/erasure
| * More fixes and tests for easure.Martin Odersky2014-03-311-26/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Object_isInstanceOf/asInstanceOf are no longer parameterized methods (seems there's no point in writing x.$asInstanceOf[T]() instead of the shorter x.$asInstanceOf[T]). 2. Array constructor's type is unchanged (the previous rules erased it to def <init>(len: Int)Object which is clearly wrong). 3. indexing needs to be disabled. 4. typedTypeApply needs to keep type applications that apply to type tests and type casts as well as array ops. 5. References to self-ids are typed ThisType(cls) before erasure; are replaced by This(cls) references during erasure.
* | Test that lazy val doesn't rewrite module definitions.Dmitry Petrashko2014-03-311-0/+9
|/
* Rename methods on FreshContext to make mutation obviousDmitry Petrashko2014-03-272-7/+7
| | | | And avoid name clashes
* Reverting decision what constitutes a double def.Martin Odersky2014-03-211-4/+5
| | | | | | | | | | | | | | | test case t0273. Was positive in Scala 2, is now deemed to be negative. Two two definitions def a = () => () def a[T] = (p:A) => () do have matching signatures, so should constitute a double definition. I previously thought that we can get away if the two definitions have different result types, but then you immediately have a problem because the denotations have matching signatures for the pruposes of "&" yet cannot be merged. Which of the two definitions would override a definition in a base class is then an arbitrary decision.
* Fix for t1292 - legal prefixesMartin Odersky2014-03-211-0/+1
| | | | | | | | The original test is now in error because the type Meta in the prefix Meta#Event is not stable and contains an abstract member Slog. Even after removing Slog, the test in pos was still in error because the bound type parameters were incorrectly recognized as abstract members. This has been fixed by the changes to Types.
* More testsMartin Odersky2014-03-211-0/+1
| | | | | | Added more tests which all pass, except for tests in disabled and pending. t0694 went from pos to neg, because the kind of alias type used in t0695 is no longer supported.
* Tests t01xx and t02xxMartin Odersky2014-03-211-2/+2
| | | | | | | | Test t0288 moved to disabled due to lack of Java interop. Test t0273 fixed by relaxing double def condition: We only regard two definitions that define the same name and have exactly the same signature as double definitions. Previously, signatures that defined the same parameters were also excluded.
* Hygienic desugaringMartin Odersky2014-03-201-0/+2
| | | | | | | | | | | | Made desugaring hygienic. Trees that are derived from some other tree are no longer stored as simple untyped Ident trees, but as TypeTrees that know how to derive their types from some other type. Test cases in pos: hygiene.scala, t0054.scala and t0085.scala. The comment in hygiene.scala points to the difficulties we are facing. In particular, we need type trees that can rebind some references of a source type to local occurrences with the same name. t0054.scala is similar to hygiene.scala. t0085.scala is trickier, but also related. Essentially the problem there is that we have a class that inherits its outer class. In this case it is important to resolve an identifier in the right context. The identifier added to the copy method of a case class must be resolved outside the class (just like the same identifier in the constructor of that case class).
* Better diagnostics for failing stub count testsMartin Odersky2014-03-201-1/+1
|
* Appromiximate union types by intersections.Martin Odersky2014-03-201-0/+1
| | | | | | | | | | | | | | | | Appromiximate union types by intersections of their common base classes. Controlled by option -Xkeep-unions. If option is set, no approximation is done. Motivations for approximating: There are two. First, union types are departure from Scala 2. From time to time they lead to failure of inference. One example experiences in Dotty was in a foldLeft, where the accumulator type was inferred to be Tree before and was now a union of two tree specific kinds. Tree was the correct type, whereas the union type was too specific. These failures are not common (in the Dotty codebase there were 3, I believe), but they cause considerable difficulty to diagnose. So it seems safer to have a compatibility mode with Scala 2. The second motivation is that union types can become large and unwieldy. A function like TreeCopier has a result type consisting of ~ 40 alternatives, where the alternative type would be just Tree. Once we gain more experience with union types, we might consider flipping the option, and making union types the default. But for now it is safer this way, I believe.
* Added auto-tupling.Martin Odersky2014-03-201-0/+2
| | | | | | | | | | | | | | Auto-tupling should satisfy the following spec. 1. An application `f(args)` where `f` is a non-overloaded method which has a single, non-repeated parameter as its first parameter list and where args consists of two or more arguments is expanded to `f((args))`. 2. A constructor pattern `C(args)` where `C.unapply` is a non-overloaded method which has a single, non-repeated parameter as its first parameter list and where args consists of two or more arguments is expanded to `C((args))`. Auto-tupling can be disabled by language feature "noAutoTupling". Conflicts: test/dotc/tests.scala
* Allow MiniPhase to be DenotTransformerDmitry Petrashko2014-03-195-39/+62
| | | | | | All MiniPhases now as are full-fledged phases, and are given their own periods and can register DenotTransformers. MiniPhases belonging to same group(list) will be squashed to single phase.
* LazyVals phase.Dmitry Petrashko2014-03-191-0/+350
| | | | | | | | | | | | | | | Creates accessors for lazy vals: 1) lazy local vals are rewritten to dotty.runtime.Lazy*** holders 2) for a non-volatile field lazy val create a non-thread-safe accessor and flag: 2.a) if lazy val type indicates that val is not nullable, uses null value as a flag 2.b) else uses boolean flag for sake of performance, method size, and allowing more jvm optimizations 3) for a volatile field lazy val use double locking scheme, that guaranties no spurious deadlocks, using long bits as bitmaps and creating companion objects to store offsets needed for unsafe methods. Conflicts: test/dotc/tests.scala
* Re-enabled and renamed testsMartin Odersky2014-03-181-4/+4
| | | | | CreateCompanionObjectTests were re-enabled. They failed in a previous version but succeed again in the latest commit. Also uncurry.scala got renamed to curried.scala.
* Refactored denotation transformersMartin Odersky2014-03-181-4/+4
| | | | | | | | Many small and large changes. Added samplePhase to demonstrate functionality. To test functioning, run the compiler with args tests/pos/uncurry.scala -Ylog:sample,terminal
* Renamings TreeTransformer -> TreeMap, TreeMapper -> TreeTypeMapMartin Odersky2014-03-182-2/+2
| | | | | | | This makes naming uniform between trees and types, and also avoids the clash with transform.TreeTransformer. The idea is that transformers are parts of phases, and have logic that is phase-specific. In particular, a context is passed around when transforming a tree. Maps are simpler, they only have a T -> T apply method.
* Test case for TreeInfo#defPathJason Zaugg2014-03-161-0/+30
| | | | | | | | | | | I'm about to refactor that method in terms of a TreeAccumulator. Note that I've packaged the test case in `dotty.tools.dotc.ast` I believe this is the best approach for organizing unit tests: the import tax is minimized, and use of relative imports is made less fragile by avoiding creating new packages to test code. I'll reorganize the other unit tests like this if others agree.
* Merge pull request #69 from odersky/topic/generalize-companionsodersky2014-03-161-0/+1
|\ | | | | Bullet-proofing companion objects
| * Bullet-proofing companion objectsMartin Odersky2014-03-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Companion class/module computations now also work for local classes and modules. For this to work, either one of two conditions must be met: (1) some enclosing context refers to a scope that contains the companions. (2) the context's compilation unit has a typed tree that contains the companions. (1) is usually true when type-checking, (2) when transforming trees. Local companions are searched as follows: If (2) holds, we locate the statement sequence containing the companions by searching down from the root stored in the compilation unit. Otherwise, we search outwards in the enclosing contexts for a scope containing the companions.
* | CreateCompanionObjects transformerDmitry Petrashko2014-03-131-0/+117
| | | | | | | | | | A transformer that provides a convenient way to create companion objects.
* | PostTyper transformersDmitry Petrashko2014-03-131-0/+117
|/ | | | | | | 1) reorders companion objects so that they allways follow matching classes 2) removes imports and named arguments 3) rewrites all trees holding types are to TypeTrees
* Merge pull request #60 from odersky/fix/#50-volatileodersky2014-03-121-0/+1
|\ | | | | Fix/#50 volatile
| * Fix of #50 - volatileMartin Odersky2014-03-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Volatile checking needs to take all intersections into account; previously these could be discarded through needsChecking. Plus several refactorings and additions. 1) Module vals now have Final and Stable flags set 2) All logic around isVolatile is now in TypeOps; some of it was moved from Types. 3) Added stability checking to Select and SelectFromType typings. Todo: We should find a better name for isVolatile. Maybe define the negation instead under the name "isRealizable"?.