aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Simplified condition in isSubType.Martin Odersky2015-01-101-2/+2
|
* Rename RefinedThis -> SkolemTypeMartin Odersky2015-01-108-47/+40
| | | | | Also, make binder type of SkolemType refer to arbitrary type, not necessarily RefinedType.
* Reverting the idea that RefinedThis types take levels.Martin Odersky2015-01-109-164/+49
| | | | | | | | | | | | | | | In the end, this did not buy us anything. What matters is that - we can reliably identify RefinedThis types pointing to a given refinement type. Making sure that the `binder` field of q RefinedThis type in a refinedInfo is always the containing refined type is good enough for that. - we take care to rebind RefinedThis types in isSubType. This was leaky before, is handled now better in the new isSubType. So, in the end, adding a level was a needless complication. Also, as a next step we should be able to identify skolem types and RefinedThis types.
* Split off ConstraintHandling into separate trait.Martin Odersky2015-01-104-272/+285
|
* Removed some checksMartin Odersky2015-01-102-12/+1
| | | | | Checks are no longer interesting because we will not to migrate to RefinedThis(level) scheme after all.
* Made refinement subtype fastpath insensitive to RefineedThis#binder.Martin Odersky2015-01-092-6/+13
| | | | | | | | Since the binder field in RefinedTypes should not be significant for subtyping, we need to substitute RefinedThis types away before comparing refinements. But this substitution is only done in the slow path. The fix falls back to the slow path if a refinement refers to the refined type via a refined this.
* TypeComparer cleanups.Martin Odersky2015-01-091-54/+56
| | | | Move non-essential code to diagnostics plus some other small cleanups.
* More aggressive reduction in lookupRefinedThis.Martin Odersky2015-01-093-26/+42
| | | | See comment for an example what changes.
* Simplification for lookupRefinedMartin Odersky2015-01-091-5/+1
| | | | | Dropped a member calculation which was unncessessary and which would not work anymore if RefinedThis types lost their RefinedType target field.
* Made fast path for refined subtype checking configurable.Martin Odersky2015-01-092-2/+6
| | | | | A configuratin now decides whether fast path is taken or not. That way we can more easily test either way if something goes wrong.
* Remove unnecessary nested methods in TypeComparer.Martin Odersky2015-01-091-497/+478
| | | | | The previous idea to keep original types around in `origN` types to be accessed from nested methods was not needed in the end.
* New fast path for checking refined types.Martin Odersky2015-01-091-8/+44
| | | | | As before, optimize for the case where correspnding refinements have the same name and the lower one is a type alias.
* Fix problem in constraint handlingMartin Odersky2015-01-092-80/+105
| | | | | | | | | | | | | | | | | | After last commit, dotc/config died with the "isSatisfiable" assertion in TypeComparer. The problem was that when deeling with a variable/variable constraint A <: B we treated this as the two independent actions of adding A <: B B >: A But this means we no longer have a clean inductive satisfiability check before something gets added - A <: B gets added before the satisfiability check of B >: A is started. The fix splits satisfiability check and actual constraint update in two separate actions.
* Optimize for case where RefinedThis is absentMartin Odersky2015-01-092-3/+9
| | | | | | | | Since we cache the information whether a refinement contains RefinedThis occurrences to the refinement itself, we can use this info to avoid substututing RefinedThis types. Used in findMember and hasMatchingMember. The commit uncovered an issue with constraint handling that will be fixed in the next commit.
* Refacttored skolemization logicMartin Odersky2015-01-085-133/+150
| | | | ... into a new trait "Skolemization".
* Remove choice between new and old scheme for subtyping refined types.Martin Odersky2015-01-082-189/+17
| | | | Now that new scheme works we can drop the alternative.
* Simplify and fix bounds propagation in constraints.Martin Odersky2015-01-083-120/+150
| | | | | | | | | | | | | | | | | | | | | | | | | The previous scheme did not ensure that transitivity was eliminated. Example scenario: We have in the constraint P <: Q for constrained variables P, Q and add Q <: T Previous propagation added the constraint and then tested whether the bounds of all variables were satisfiable. For Q we test P <: T but that is true because P <: Q and we already added the constraint Q <: T. So we fail to add the constraint P <: T, and transitivity is no longer eliminated. Instead we now test the new bounds (in this case P <: T) *before* adding the new constraint Q <: T. This is also simpler than the previous scheme.
* New scheme for subtyping refined types.Martin Odersky2015-01-083-53/+139
| | | | | | | | | | | | | | | | - Instead of rebasing, use the DeBrujn level of a RefiendThis. - Make sure lower type is a singleton by skolemizing it if necessary. - Do the correct rebinding of the upper type's RefinedThis. Remarks: - The new scheme discovered quite a lot of errors which are mostly fixded in other commits of this branch. i0268 (GADT matching) still does not work, moved to pending. - Some optimizations are currently missing: (1) fast path refined subtyping (2) faster operations for substituting refined thistypes which explot the fact that RefinedThis is relatively rare.
* Add transitive check for cycles in constraints.Martin Odersky2015-01-082-1/+53
|
* Add deSkolemize method.Martin Odersky2015-01-082-1/+103
| | | | | We will need that at some point because type checking refined types will generate skolem variables for representing RefinedThis types if the lower type is not a singleton.
* Fixed bug that caused error message to be suppressed.Martin Odersky2015-01-082-12/+8
| | | | | | Symptom was: When compiling Definitions.scala with the changes in the subsequent commits, an empty tree was passed as implicit parameter, without an "implicit not found" error being reported. The problem needed a fix in TyperState.
* Deleted diagnostics output that caused cyclic referencesMartin Odersky2015-01-061-1/+0
| | | | | | | | Cyclic reference was caused when compiling pos/i94-nada.scala with typer = new Printer and -Yfront set.
* Make findMember depend on RefinedThis level.Martin Odersky2015-01-034-23/+145
| | | | | | When doing a findMember we now look at the level of a RefinedThis instead of its `rt` field. This required several fixes to how levels are assigned to RefinedThis types.
* Show level for RefinedThisMartin Odersky2015-01-031-2/+2
| | | | Temporary solution for better diagnsitics.
* isSubType reorgMartin Odersky2015-01-011-99/+112
| | | | | Capture original types in enclosing scope instead of passing them explicitly.
* Extended refinementRefersToThis to alias types.Martin Odersky2015-01-011-6/+4
| | | | | | | | | Given class C { type T } C { type U = this.T } { val x: U } the second refinement does refer via the alias to the refinement type itself.
* Make use of refinementRefersToThis in lookupRefinement.Martin Odersky2015-01-011-28/+15
| | | | That way we profit from caching.
* Removed debug printlnMartin Odersky2015-01-011-1/+1
|
* Provide the correct levels for RefinedThis types.Martin Odersky2015-01-017-22/+38
|
* Reorg of subtyping.Martin Odersky2015-01-018-446/+505
| | | | Plus, RefinedThis gets a second parameter, `level`. This will replace the first one in due time.
* Better name for patternMartin Odersky2014-12-311-1/+1
|
* Handle subtyping cases involving null.Martin Odersky2014-12-221-6/+8
| | | | | | | Cases handled are: Null <: (A & B) { ... } Null <: (A | B) { ... }
* test reorgMartin Odersky2014-12-214-1/+3
| | | | Moved working tests to pos, annotated non-working ones.
* tests reorgsMartin Odersky2014-12-216-0/+35
| | | | Move some tests into proper slots + comments what they are.
* Don't emit copy method for case classes with repeated parameters.Martin Odersky2014-12-202-1/+5
| | | | | | | | scalac has the same restriction. The reason is that we do not have a means to specify a sequence-valued default for a vararg parameter. It would be nice if we could, but this requires a more substantial development effort.
* New passing tests.Martin Odersky2014-12-192-0/+31
|
* Harden implicit scope computation against CyclicReference errors.Martin Odersky2014-12-194-33/+6
|
* Removed dead code.Martin Odersky2014-12-191-5/+1
| | | | isUnboundedGeneric imples !JavaDefined anyway.
* Fix isUnboundedGeneric for alias types.Martin Odersky2014-12-192-3/+55
| | | | | Fixes problem in test case SI-7638a.scala which gave an override error before.
* Avoid name clashes when generating synthetic companion objects.Martin Odersky2014-12-195-7/+31
|
* Eliminate unused method from RefChecks.Martin Odersky2014-12-191-6/+0
|
* Test re-org.Martin Odersky2014-12-196-23/+3
| | | | Moved some working test to pos. I wonder why they were in pending? They did work for me.
* Fix NoCyclicReference testMartin Odersky2014-12-192-11/+11
| | | | | | The problem was that, unlike a classDefSig, a higher-kinded typeDefSig did not get a preset info with its type parameters. So any type-application of the defined type in its bounds would fail.
* Disable context escape detectionMartin Odersky2014-12-191-2/+3
| | | | | | | | | I get very frequent build failures due to the mutual Scala<->Java dependency. It builds for a long time, then decides that getCtx overrides nothing. The only way to fix is another clean build. Total time lost: >5 minutes. These happened occasionally before but have become much more frequent under ScalaIDe4.0, to the point where this becomes a major drag on productity. Context escape detection is nice but if it stops us getting work done, not worth the effort.
* Merge pull request #271 from dotty-staging/fix/i268-gadtsodersky2014-12-196-45/+67
|\ | | | | Fixed #264 - failure to typecheck GADTs
| * Made gadt map better encapsulated.Martin Odersky2014-12-163-3/+8
| |
| * Fixed #264 - failure to typecheck GADTsMartin Odersky2014-12-166-45/+62
| | | | | | | | | | | | | | | | | | | | | | | | The previous scheme derived the right bounds, but then failed to use them because a TypeRef already has a set info (its bounds). Changing the bounds in the symbol by a side effect does not affect that. This is good! But it showed that the previous scheme was too fragile because it used a sneaky side effect when updating the symbol info which failed to propgate into the cached info in TypeRef. We now keep GADT computed bounds separate form the symbol info in a map `gadt` in the current context.
* | Merge pull request #308 from smarter/change/Ylog-2odersky2014-12-183-18/+23
|\ \ | | | | | | -Ylog:X now only log phase X, use -Ylog:X+ to also log phase X+1
| * | -Ylog:X now only log phase X, use -Ylog:X+ to also log phase X+1Guillaume Martres2014-12-183-18/+23
| | |
* | | Merge pull request #307 from smarter/simplify/TypeAlias-unapplyodersky2014-12-181-4/+1
|\ \ \ | | | | | | | | Simplify TypeAlias#unapply