aboutsummaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* 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"?.
* | Improve test infrastructureMartin Odersky2014-03-102-43/+62
|/ | | | | | | | | 1) New method compileFiles which allows one to compile the content of a directory one file or directory after another. 2) max constraint is printed to typr. Added new test pos_all. Other pos tests can be retired.
* Added test for overloaded access with import/inheritance conflictMartin Odersky2014-03-071-0/+1
|
* Merge pull request #43 from DarkDimius/tree-transformerDmitry Petrashko2014-03-061-0/+179
|\ | | | | Tree transformer&TreeTransform
| * Tree Transformer&TreeTransform:Dmitry Petrashko2014-03-061-0/+179
| | | | | | | | | | | | | | | | 1) using fast tracks in case node type isn't altered by Transformation; 2) using pre-computed hints(nxTransformXXX arrays) to quickly jump to next transformation interested in transforming particular Tree type; 3) using pre-computed hints(nxPrepareXXX arrays) to know which transformations are going to 'prepare' for transforming particular Tree type; 4) recomputing those hints in case some transformation changed implementation class during 'prepare'; 5) TreeTransform is now responsible of calling transformFollowing on nodes created by it.
* | Fix of #39Martin Odersky2014-03-041-0/+2
|/ | | | | | | | Two fixes: 1) Avoid the infinite recursion in checkAccessible if the accessibility check fails. 2) Make accessibility succeed for the test, and in general if the target denotation does not have a symbol. Added original test in pos and a negative test which makes accessibility fail.
* Merge pull request #35 from DarkDimius/tests-2Dmitry Petrashko2014-03-032-19/+29
|\ | | | | For some tests context is required, it should be passed to checker phase.
| * For some tests context is required, it should be passed to checker phase.Dmitry Petrashko2014-03-032-19/+29
| |
* | Merge pull request #38 from odersky/fix/#34-pathresolversDmitry Petrashko2014-03-031-0/+6
|\ \ | |/ |/| Fix/#34 pathresolvers
| * Add test case for #34Martin Odersky2014-03-031-0/+6
| | | | | | | | Right now this one fails.
* | Merge pull request #31 from DarkDimius/testsDarkDimius2014-03-022-0/+40
|\ \ | |/ |/| | | Infrastructure for per-phase tests, with inline source as a string.
| * Infrastructure for per-phase tests, with inline source as a string.Dmitry Petrashko2014-03-012-0/+40
| |
* | Fix problem when handling structural types without a nominal parent type.Martin Odersky2014-03-011-0/+1
| | | | | | | | We need to use Object as parent then, but this was forgotten.
* | Check that inferred parent classes are feasible.Martin Odersky2014-03-011-1/+1
| |
* | Reorganization of template parents.Martin Odersky2014-03-011-0/+3
|/ | | | | | | | | | | Template parents always were constructor calls before. This is not correct because in a situation like the one elaborated in templateParents, the trait D has the class C as supertype, but it does not call its constructor (in fact, if we added a () parameter list to make it into a constructor this would be wrong because C takes parameters. Now parents can be either types or constructor calls. The logic in Namer and Typer that deals with parents is cleaned up. In particular, we now construct any synthetic class parent as a full type, before calling normalizeToClassRefs. This obviates the forwardRefs logic that needed to be done in a cleanup of Namers. Also added two more checks: (1) All parents except the first one must point to traits. (2) A trait may not call a parent class constructor.
* Update some paths to relativeNada Amin2014-02-241-4/+4
|
* Made blacklist in ScannerTest ignore the source path location of the ↵Martin Odersky2014-02-161-4/+4
| | | | blacklisted file.
* Add Scalac scanning to the Travis CI buildVlad Ureche2014-02-161-8/+13
| | | | | And silence some of the error messages we print so the build log doesn't go above 4MB (Travis' limit)
* New worksheet highlighting some symbol and tree constructionsMartin Odersky2014-02-141-0/+104
|
* Merge branch 'origin/master'Martin Odersky2014-02-111-2/+2
|\
| * Towards #4: dotc.tests working on my machineVlad Ureche2014-02-061-2/+2
| | | | | | | | File name issues
* | New scheme for incremental invalidation of parents.Martin Odersky2014-02-101-1/+9
| |
* | Make Definitions load all symbols in current runId.Martin Odersky2014-02-102-2/+2
| |
* | WIP: Fixes to bring symbols forwardMartin Odersky2014-02-092-1/+2
| |
* | Generalize test infrastructureMartin Odersky2014-02-071-7/+6
| | | | | | | | Compiler tests can now be run with configurable number of compilers and runs in a compiler.
* | Make skolems live forever...Martin Odersky2014-02-061-5/+8
| | | | | | | | ... because there's no way to reload them in a new run.
* | Checking for already existing symbols before creating new ones.Martin Odersky2014-02-061-0/+13
|/ | | | | Otherwise we get spurious "compiled twice" errors on every symbol defined in a run after the first one. Also, fixed a bug so that now run ids are correctly incremented.
* Fixed ScannerTest to make it work with relative pathsMartin Odersky2014-02-061-2/+2
|
* Made showclass tests more robust if fewer stubs are generated than the limit.Martin Odersky2014-02-061-1/+1
|
* One more absolute path changed to relativeDmitry Petrashko2014-02-061-1/+1
|
* Use relative paths in testsDmitry Petrashko2014-02-064-13/+13
|
* Avoid accessing implicits that come from root imports that are hidden by ↵Martin Odersky2014-02-021-1/+1
| | | | | | | | | | | | some nested import. This also changes the criterion when a root import is disabled. A root import is now disabled if there is an inner import from the same package or module, and the inner import contains at least one disabling clause X => _. (The latter crierion is new; without it, we would consider something like import scala.{collections => c} as a hiding import for Scala, which seems to go too far.)
* Cheaper eligibility test for PolyTypes.Martin Odersky2014-02-021-0/+1
| | | | Instead of doing a wildApprox of the whole type, we fuse with the logix for method types and just do a wild approx of the single method type argument we have to test.
* Fixes to constraint handling.Martin Odersky2014-01-261-1/+2
| | | | | | | | In particular, need to unify polyparams before replacing one with the other, if the result wiould lead to a cyclic constraint. Also: Avoid setting `inst` field of a type variable if a subtype operation is in progress, because the constraint might be retracted, and the instantiation should be retracted with it. Third, tighter checks of cyclic constraint, and deep subtype recursions can now be demanded to cause an abort.
* Avoid eager forcing in enterArgBindingMartin Odersky2014-01-201-1/+7
| | | | Caused a cyclic reference error when compiling the three files in test "testNonCyclic".
* Adapt fun prototype when looking for second chance implicits (aka BigInt)Martin Odersky2014-01-191-1/+3
| | | | | | | | | | If we look for aprototype of the form select(name, FunProto(args, ...)) it's important that the result type of the FunProto type is a wildcard type, because implicit views are disabled for that match. --- this commit achieves the first bootstrap of dotty! ---
* More tests.Martin Odersky2014-01-181-0/+2
|