aboutsummaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Enabled variance checkingMartin Odersky2014-08-035-2/+74
| | | | | | | Variance checking is now run as part of type-checking. Fixed tests that exhibited variance errors. Added tests where some classes of variance errors should be detected.
* Added test case for varargs bridgesMartin Odersky2014-08-032-0/+15
| | | | | | Currently we cannot run this test automatically because the testing framework does not know about .java files. It was run manually and verified that ElimRepeated does was it is supposed to do (create a varargs bridge).
* Add test for tailcallDmitry Petrashko2014-07-221-0/+4
| | | | Test for order of type parameters in recursive call
* Merge pull request #149 from dotty-staging/fix/#148Nada Amin2014-07-202-0/+88
|\ | | | | fix/#148
| * fix/148Martin Odersky2014-07-202-0/+88
| | | | | | | | Fixed typo in Splitter. Closes #148.
* | Added test for #143 to regression testsMartin Odersky2014-07-191-0/+0
| |
* | Fixed #143Martin Odersky2014-07-191-0/+14
|/ | | | | The problem was that TermRefWithSignatures did not take shadowed names into account when reconstituting themselves under a new prefix.
* Handle selftypes in FullParameterizationMartin Odersky2014-07-171-0/+6
| | | | Adapt the transformation so that self types are handled correctly.
* Fix to rewire typesMartin Odersky2014-07-173-2/+22
| | | | | | | t6574 has a new test where we produce identical code in an if-then-else. This broke the rewiring logic before, and is fixed now. Also, more comments and test cases.
* Enabled ExtensionMethodsMartin Odersky2014-07-171-0/+109
| | | | | | | | | Fixed extension methods so that it now runs and passes the build. Also enables ElimRepeated, which is a prerequistite for ExtensionMethods. Exception: Tailrec is currently disabled, because it needs to run before ExtensionMethods but it fails the -Ycheck test. Therefore the current tests skip this phase.
* Removed test caseMartin Odersky2014-07-171-17/+0
| | | | | d.T is an access to a structural type member, so rejecting this is OK. Not sure why we compiled this before without warning.
* Added phase: SuperAccessorsMartin Odersky2014-07-171-0/+11
| | | | | Rewrote SuperAccessors (more to be done; see comments), and added stuff here and there to make it work smoother.
* Added test case for LMS inspired HK code.Martin Odersky2014-06-261-0/+43
| | | | Closes #94.
* Avoid caching values that depend on typevar state.Martin Odersky2014-06-201-0/+0
| | | | | | | | | | | | | | TypeVars flip from the initial state, where underlying == origin to the final state where underlying == inst. This flip can invalidate information that depends on the underlying type of a TypeVar. Since we do not know when the flip occurs, we need to avoid keeping any such information in a cache. The commit makes three caches depend on a new value: typerState.ephemeral. The value is set to `true` each time we follow the underlying type of a TypeVar, and this disables cached information to be retained. A test case for this commit is t2693.scala. This test passes typechecking with the previous commit, but fails in -Ycheck:front because of stale cache info in an "#Apply" typeref. The present commit fixes that.
* Fixes to lambda abstractionMartin Odersky2014-06-191-0/+0
| | | | | | 1) Honor variance of Apply and $hkArgs when instantiating them 2) Eta-lifting a higher-kinded type is straight eta expansion, no arguments are applied.
* Handling higher-kinded types with lambdasMartin Odersky2014-06-1813-14/+171
| | | | | 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-122-0/+21
| | | | | | | | | | | | | | 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.
* Avoid classtype checking for refinements.Martin Odersky2014-05-301-0/+22
| | | | | | In a refinement type T { R } we do not need T to be a class. But analyzing the refeinement type will create a temporary class type. This refinement class has to be treated specially in what concerns parent types.
* Simplify result handling in FunProto.Martin Odersky2014-05-301-0/+7
| | | | | | Following the example of SelectionProto, we now always hide the result in a FunProto behind an IgnoreProto. This avoids a special case retry with a weaker FunProto in tryInsertApplyOrImplicit.
* Always ignore type in selectionProtoMartin Odersky2014-05-301-0/+8
| | | | | | | | | | | | | The type of a SelectionProto needs to be ignorable because there might be an implicit conversion on the selection. E.g. implicit def a2b(x: A): B = ??? val x: { a: A } = ??? val b: B = x.a This was previously handled by allowing implicit conversions in compatibility checks. But it turns out we can afford to ignore the type of a selectProto and unignore on ambiguities later.
* Reclassifying testsMartin Odersky2014-05-303-9/+10
|
* Triage of tests t27xx-t29xx.Martin Odersky2014-05-3039-4/+6
|
* tests t26xxMartin Odersky2014-05-3016-0/+286
|
* typedTyped needs to maintain Mode.Martin Odersky2014-05-302-0/+29
| | | | | The first part of a type ascription e: T can be a pattern or an expression. The mode has to be kept depending on what it was on the outside.
* Fix of t2591.Martin Odersky2014-05-301-0/+0
| | | | | | | Needed to wrap a dummyTreeOfType in a TypedSplice to prevent re-typechecking. (In fact, the "tree without pos" check revealed a deeper problem: DummyTrees of types could be typed again, but without the surrounding TypedSplice, the originally stored type would be forgotten and Null would be returned.
* Added t25xx testsMartin Odersky2014-05-306-0/+70
|
* Fix of t2504Martin Odersky2014-05-308-76/+1
| | | | | | | | | Another problem where we need to insert an implicit on the result type of complex operation. Two additions: (1) If adapt fails, we now try with a weaker FunProto without result type, thus allowing for an additional implicit cpmversion on the result. (2) An Application in a committable context will not fail if the result type does not match the expected one. The problem will be simply deferred in that case.
* Fix of pos/t2454Martin Odersky2014-05-3014-0/+0
| | | | "_" type paraeters need to be given fresh names.
* remove test t1591b because it depends on scalac 2 sourceSamuel Gruetter2014-05-201-13/+0
|
* Fix of pos/t2429Martin Odersky2014-05-201-0/+0
| | | | | | | | | | | | | | | | | This was a hard nut to crack. The problem exemplified by t2429 is that in a situation like val x: T = foo(...) where `foo` needs implicit parameters the expected result type `T` is propagated into the typechecking of foo(...) and consequently also into the implicit parameter search. This is often necessary, for instance to instantiate type parameters. But it can lead to overconstrained searches if in fact the right expansion is val x: T = viewToT(foo(...)(implicit params)) where `viewToT` is some implicit conversion. The fix handles that case by re-hecking the application foo(...) with an empty result type, if the implicit parameter search fails. But the re-checking is very subtle as is explained in the comment to `TyperState#tryWithFallback`.
* Nothing is not a superclass of Null.Martin Odersky2014-05-202-0/+35
| | | | | | | | Fix so it isn't. This caused an error in ErrorReporting because we do not propagate bounds into a type like ValOrDefDef[_]. Error in `ErrorReporting` is now fixed but the problem is reflected in test case `boundspropagation`.
* Tests pos/23xx to 24xx.Martin Odersky2014-05-2037-37/+0
|
* Avoid hoisting of local classes out of method bodies.Martin Odersky2014-05-202-2/+42
| | | | | | | | | | Doing so is unsound. We instead approximate local classes by their parents, but only if the expected type is not fully defined. This makes the test t2421_delitedsl1.scala in the commit pass. The oter test, blockEscapesNeg.scala is modified to fail. Previously it failed outright but with the new rules the nested class Bar is approximated to Object. That means that the block containing `Foo.Bar` typechecks, but with type `Object` instead of the unreachable `Bar`.
* More systematic treatment of prototypes.Martin Odersky2014-05-204-0/+7
| | | | | | | | | | | | | | | | | | | 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.
* Tests pos 20xx 21xxMartin Odersky2014-05-2026-19/+1
|
* Fix of SI 2133Martin Odersky2014-05-201-0/+18
| | | | We now restrict wildcard imports to members that are accessible at the point of import. This is a fix of an open Scala ticket.
* Pos tests t17xx - t19xxMartin Odersky2014-05-2049-8/+36
|
* More testsMartin Odersky2014-05-1259-283/+32
|
* Re-enable t0786.Martin Odersky2014-05-081-0/+0
| | | | t0786 works again after type inference fixes. Re-enabling.
* Fixing tailrec test.Martin Odersky2014-05-081-1/+1
| | | | | null is not a subtype of a singleton type in Dotty. This slipped by the type checker before. With the tightened rules in the next commits, it will become illegal.
* Moved tests to pending because they fail -Ycheck:frontMartin Odersky2014-05-082-0/+0
|
* New phase: NullarifyMartin Odersky2014-04-151-0/+13
| | | | Eliminates ExprTypes and PolyTypes over value types.
* Fixing prefix of implicit membersMartin Odersky2014-04-141-0/+19
| | | | | | | Implicit members are TermRefs that should have a prefix corresponding to the object of which they are a member. They used to have the ThisType of their owner before. `implicits2` provides a way to verify that the change works. It would be good to turn this into a more robust test at some point. But it's not high preiority, so I prefer no test to a fragile test.
* TailRec phase and tests for it.Dmitry Petrashko2014-04-1122-16/+21
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Shadowed referencesMartin Odersky2014-04-081-0/+7
| | | | | | | | | | | | | | | | | | | In TypeAssigner#ensureAccible we sometimes pick an inherited public member as the denotation of a NamedType instead of an inaccessible private one. The problem is that both are denotations for the same type, which caused a noDoubleBindings assert failure. We now solve this problem by creating a "shadowed" named type to hold the inherited member. The shadowed named type is distinguished by its name, which reads (inherited)originalName In the future, we should make this more robust by using a general tagging scheme to create shadowed names. Another fix is about import symbols. They are now referenced with NonMemberTermRefs. With this fix, the test suite passes with no double def violations.
* CleanupsMartin Odersky2014-04-081-0/+3
| | | | | Conflicts: src/dotty/tools/dotc/transform/Splitter.scala
* Flag self names that conflict with parameters or membersMartin Odersky2014-04-082-64/+82
| | | | | | | | | A self name may no longer have the same name as a parameterless class member (or param accessor). The restriction makes sense because otherwise scoping is confusing. It's needed because otherwise we get TermRefs that have the same name and prefix but denote different things. Moved some code which exercises this from pos/typers to neg/typers
* Fleshed out Splitter phaseMartin Odersky2014-04-083-0/+11
| | | | | | | 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.
* Merge pull request #109 from DarkDimius/erasure-bridgesDmitry Petrashko2014-04-041-0/+11
|\ | | | | Bridge generation in erasure implemented.
| * Bridge generation in erasure implemented.Dmitry Petrashko2014-04-041-0/+11
| | | | | | | | | | | | Relies on meaning of "override" to see which bridges are required. Doesn't take in account value classes for now Uses 'adapt' used by erasure for converting arguments and return value.