aboutsummaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* Appromiximate union types by intersections.Martin Odersky2014-03-201-0/+96
| | | | | | | | | | | | | | | | 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-202-0/+20
| | | | | | | | | | | | | | 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
* Merge pull request #81 from DarkDimius/integration/lazyodersky2014-03-201-0/+6
|\ | | | | Allow MiniPhase to be DenotTransformer & LazyVals
| * Re-enabled and renamed testsMartin Odersky2014-03-181-0/+0
| | | | | | | | | | 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-0/+6
| | | | | | | | | | | | | | | | 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
* | move all tests in tests/untried/neg which use implicits to ↵Samuel Gruetter2014-03-19113-0/+0
| | | | | | | | tests/untried/neg-with-implicits
* | apply srewrite (no procedure syntax for constructors) to tests/untried/negSamuel Gruetter2014-03-193-6/+6
| |
* | apply srewrite (explicit types for implicits + no procedure syntaxSamuel Gruetter2014-03-1940-65/+65
|/ | | | for constructors) to tests/untried/pos
* Merge pull request #69 from odersky/topic/generalize-companionsodersky2014-03-162-0/+44
|\ | | | | Bullet-proofing companion objects
| * Bullet-proofing companion objectsMartin Odersky2014-03-132-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge pull request #70 from odersky/fix/annotations-in-patternsodersky2014-03-141-3/+9
|\ \ | | | | | | Fixed two problems with annotated types in patterns
| * | Fixed two problems with annotated types in patternsMartin Odersky2014-03-141-3/+9
| |/ | | | | | | | | | | | | | | | | | | Problem 1: The parser did not accept them. It has to accept a "RefinedType" as an ascription, not a "WithType" (as it did before), or even a "SimpleType" (as speced in the SyntaxSummary). Problem 2: Annotations are always typed as expressions. The annotations in question were typed as patterns before. Tests in Patterns.scala and in the Dotty compiler itself.
* | add tests from scala/test/files/{pos,neg}Samuel Gruetter2014-03-123539-0/+49725
| | | | | | | | with explicit Unit return type
* | Added test for implicits which fail in Scala 2.11.Martin Odersky2014-03-121-2/+10
|/ | | | Mentioned in scala-user by Haoyi Li on 12-Mar-2014
* Merge pull request #61 from odersky/fixes-t00xxodersky2014-03-123-0/+16
|\ | | | | Fixes t00xx
| * Fix constructor completion problem detected in t0054Martin Odersky2014-03-121-0/+4
| | | | | | | | | | | | | | | | | | Constructors need to be completed in the context which immediately encloses a class. Otherwise type references in the constructor see the wrong types, as is demonstrated in t0054. The difficulty here is that the inner class B nested in A also extends from A. Then it makes a difference whether the constructor parameter types of B are resolved in the context of B or in the context of A. Added explanation for context handling of constructors.
| * Fix problems related to t0039Martin Odersky2014-03-101-0/+6
| | | | | | | | | | | | | | | | | | | | | | This test case exercised several problems: 1.)2.) Two ways to run into a cyclic references. Fixed by - assuming an early info when completing a typedef, similarly to what is done for a classdef - doing wellformed bounds checking in a later phase. Failure to check whether arguments correspond to F-bounds. - a substitution was missing.
| * Fix for t1002Martin Odersky2014-03-101-0/+6
| | | | | | | | | | Need to compile the self type of a class not in the context of the class members but one context further out. Reason: self type should not be able to see the members.
* | Merge pull request #60 from odersky/fix/#50-volatileodersky2014-03-121-0/+25
|\ \ | |/ |/| Fix/#50 volatile
| * Fix of #50 - volatileMartin Odersky2014-03-091-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-101-264/+0
|/ | | | | | | | | 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.
* Removed useless ValDef flagged by @samuelgruetter in previous pull requestMartin Odersky2014-03-071-0/+18
|
* Fix of #39Martin Odersky2014-03-042-0/+36
| | | | | | | | 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.
* Typos corrected.Dmitry Petrashko2014-03-031-1/+1
| | | | | More verbose assertions. Unnecessary semicolons removed.
* Rename baseType -> baseTypeRefMartin Odersky2014-03-021-0/+21
| | | | | | | What was `baseType` and is now `baseTypeRef` only computes the prefix of of basetype, not the type arguments. If type arguments need to be included there is `baseTypeWithArgs`. The reason is that type arguments are usually already encoded as member types. But this was a source of errors because in Scala 2, baseType includes the type arguements. (also added test file structural.scala forgotten from last commit)
* Check that inferred parent classes are feasible.Martin Odersky2014-03-012-5/+21
|
* Reorganization of template parents.Martin Odersky2014-03-013-0/+32
| | | | | | | | | | | 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.
* Discard inaccessible denotations when merging.Martin Odersky2014-02-241-5/+3
| | | | | | | | | | | When froming the &=merge of two denotations, we now discard denotations which have inaccessible symbols. The reason for this change is that, without it, the following code gives the warning "cannot merge Int and Int() as members of one type, keeping only Int()". val m = new java.util.HashMap m.size Indeed java.util.HashMap has a filed and method which are both named size. The field is package private, so is inaccessible from outside java.util, however.
* Generalize test infrastructureMartin Odersky2014-02-071-1/+0
| | | | Compiler tests can now be run with configurable number of compilers and runs in a compiler.
* Fix bug for reading type arguments in ClassfileParserMartin Odersky2014-02-061-7/+4
|
* Commenting out unused alternative isSubType implementation.Martin Odersky2014-02-031-5/+9
|
* Fix problems with TypeVar instantiationMartin Odersky2014-02-031-0/+3
| | | | | 1) Simplify skipped one level over arguments of AndType/OrType. 2) variances needs to follow instantiated typevars
* Relaxing check that implicits must have explicit return typeMartin Odersky2014-02-021-1/+1
| | | | | | Now this is required only for members of a template. Local statements can still have implicits with no result type. (Maybe we need to get back on this). Also, changed Dotty itself and tests to adhere to the new restriction.
* Improve eligible caching in implicit search.Martin Odersky2014-02-021-0/+11
| | | | Improves effectiveness of elidable cache from ~66% to ~85% and reduces # of implicits that need to be checked after discarding to about 20% what it was before.
* 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.)
* Fix checking for disabled root importsMartin Odersky2014-02-021-0/+11
| | | | Needs to be done always when hitting a wildcard import, not just when something was found
* Fixes to constraint handling.Martin Odersky2014-01-262-1429/+225
| | | | | | | | 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.
* Make better use of AndOrTypes.Martin Odersky2014-01-201-26/+1452
|
* Normalize parent types so that first one always refers to a class, not a trait.Martin Odersky2014-01-191-4/+12
| | | | Also: forward type parameter references of newly added to class scope. This is necessary, or the pattern match in test.scala would fail. Need to find out why.
* Refinement of fully-defined accumulator.Martin Odersky2014-01-192-167/+24
| | | | It needs to follow type aliases in order not to give false indications what variables are contained in a type.
* Fix to computation of implicit scopesMartin Odersky2014-01-181-111/+148
| | | | For packages, the implicit scope consists of the implicit definitions in a nested `package` object, not the package itself.
* Fix isWildcardStarArg test so that it works also for typed trees.Martin Odersky2014-01-181-0/+6
|
* More tests.Martin Odersky2014-01-181-0/+6
|
* Refine avoiding local refs in block's type.Martin Odersky2014-01-181-494/+102
| | | | If all else fails, force all type variables with fullyDefinedType. This can avoid references to locals. Example in file dotctest: SourceFile.scala, method calculateLineIndices.
* Tweak to typing of function values.Martin Odersky2014-01-151-7/+14
| | | | We now propagte the expected function result type (if it exists) into the function body even if it not fully defined.
* Fix typing of unapplySeq extractor arguments.Martin Odersky2014-01-151-1/+12
| | | | Needed a special case for them.
* Making some traces conditional on printers being enabled.Martin Odersky2014-01-131-0/+6
|
* Better reporting of cyclic references involving imports.Martin Odersky2014-01-111-262/+452
| | | | Used to be "cyclic reference involving val <import>". Now prints import statement that caused the error.
* Add a constructor to class Any, so that it can be inherited.Martin Odersky2014-01-101-0/+337
|
* New subtype constraint maintenance algorithm.Martin Odersky2014-01-071-0/+5
| | | | | | | | | | Objective: Avoid cycles by detecting all cases where A <: B and B <: A and removing those cases by unifuing A and B. Cycles need to be avoided because they lead to deep subtype recursions.