-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/refined subtyping #331
Merged
Merged
Changes from 68 commits
Commits
Show all changes
72 commits
Select commit
Hold shift + click to select a range
7c40b03
test reorg
odersky 9d8e473
Handle subtyping cases involving null.
odersky e50f47c
Better name for pattern
odersky e3a4380
Reorg of subtyping.
odersky 95f74c2
Provide the correct levels for RefinedThis types.
odersky 390ac42
Removed debug println
odersky 6543f89
Make use of refinementRefersToThis in lookupRefinement.
odersky bd405e5
Extended refinementRefersToThis to alias types.
odersky 9c1d486
isSubType reorg
odersky a7a603f
Show level for RefinedThis
odersky 14f6eb0
Make findMember depend on RefinedThis level.
odersky 2085ebb
Deleted diagnostics output that caused cyclic references
odersky 5e61149
Fixed bug that caused error message to be suppressed.
odersky 74b2584
Add deSkolemize method.
odersky 1309f0f
Add transitive check for cycles in constraints.
odersky 0a35baa
New scheme for subtyping refined types.
odersky 979ff5e
Simplify and fix bounds propagation in constraints.
odersky 0bc9f68
Remove choice between new and old scheme for subtyping refined types.
odersky 9f74533
Refacttored skolemization logic
odersky 90f2668
Optimize for case where RefinedThis is absent
odersky cb103db
Fix problem in constraint handling
odersky 53db7c8
New fast path for checking refined types.
odersky f11a0a5
Remove unnecessary nested methods in TypeComparer.
odersky ee191f3
Made fast path for refined subtype checking configurable.
odersky 3c159db
Simplification for lookupRefined
odersky 2ae7f2a
More aggressive reduction in lookupRefinedThis.
odersky acb64b2
TypeComparer cleanups.
odersky 710e40e
Made refinement subtype fastpath insensitive to RefineedThis#binder.
odersky 4429243
Removed some checks
odersky 5f35b11
Split off ConstraintHandling into separate trait.
odersky 97aced0
Reverting the idea that RefinedThis types take levels.
odersky 1d8c014
Rename RefinedThis -> SkolemType
odersky 90c8ac3
Simplified condition in isSubType.
odersky 9c53aaa
Adapted Skolemization to new handling of skolems.
odersky 7df0423
Made constraint data structures pluggable.
odersky f76e81e
Streamline unification
odersky 0b02ede
Added structural equals method to PolyParams
odersky 1550492
Added alternative TrackingConstraint
odersky 3e3ef52
Two new hooks in ConstraintHandling
odersky ef9c11f
Fix after review: reset state variable needsGc
odersky dec4617
New test: moduleSubtyping
odersky 1a6cc68
Rename isConstrained -> canConstrain for clarity
odersky a24f73e
Removed redundant test in isSubType.
odersky c0b7509
Fixed bug/typo in comparing prefixes of ClassInfo types.
odersky 1923483
Allow to merge TypeBounds and ClassInfos in |, &
odersky 566dd6e
Fix skolemization logic.
odersky fbe4171
New constraint handling
odersky 179a1bb
Removed check from addConstraint
odersky 952aa7f
Avoid adding constraint under typeVarsMissContext is true
odersky 23ae8d9
Dropped non-sensical transform in unify
odersky 14f4c96
Removed checkBound tests
odersky 9b260d0
Moved previously failing tests to pos
odersky 5354f88
Fixed soundness hole in TypeComparer
odersky 6771786
Compare ThisType refactoring
odersky 50444f8
Refactor handling of NamedTypes in isSubType
odersky 01f1a26
Refactorings in TypeComparer fourthTry
odersky 68d58a6
Move PolyParam test later in isSubType and simplify addConstraint
odersky b9d018e
Make checkPropagated configurable
odersky 963af8e
Streamline TypeComparer/ConstraintHandling interface.
odersky eed18aa
Small polishings for isSubType
odersky b45c69f
Plugging a possible hole in unify
odersky fd3a5be
New constraint method: narrowBound
odersky 8061820
New constraint implementation: OrderingConstraint
odersky 47238eb
Some finetunigs in TypeComparer.
odersky cdce02d
Fixes suggested by reviews from @smarter.
odersky 2576193
Some small polishings in TypeComparer
odersky f0e60d3
Replace only substitutes top-level types.
odersky eb4d808
Added explanation to comment.
odersky a493791
Fixups taking into account reviewer's comments.
odersky 350b121
Refinement of dependent parameter handling in OrderingConstraint
odersky 37918e5
Cleanups prompted by reviews.
odersky 70e55d2
Fixed problem with ensureSingleton
odersky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,33 @@ object Config { | |
|
||
final val checkCacheMembersNamed = false | ||
|
||
final val checkConstraintsNonCyclic = true | ||
|
||
/** When updating a connstraint bound, check that the constrained parameter | ||
* does not appear at the top-level of either of its bounds. | ||
*/ | ||
final val checkConstraintsNonCyclic = false | ||
|
||
/** Like `checkConstraintsNonCyclic`, but all constrained parameters | ||
* are tested for direct or indirect dependencies, each time a | ||
* constraint is added in TypeComparer. | ||
*/ | ||
final val checkConstraintsNonCyclicTrans = false | ||
|
||
/** Check that each constraint resulting from a subtype test | ||
* is satisfiable. | ||
*/ | ||
final val checkConstraintsSatisfiable = false | ||
|
||
/** Check that each constraint is fully propagated. i.e. | ||
* If P <: Q then the upper bound of P is a subtype of the upper bound of Q | ||
* and the lower bound of Q is a subtype of the lower bound of P. | ||
*/ | ||
final val checkConstraintsPropagated = false | ||
|
||
/** Type comparer will fail with an assert if the upper bound | ||
* of a constrained parameter becomes Nothing. This should be turned | ||
* on only for specific debugging as normally instantiation to Nothing | ||
* is not an error consdition. | ||
*/ | ||
final val flagInstantiationToNothing = false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. failOnInstantiationToNothing seems like a better name There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK |
||
|
||
/** Enable noDoubleDef checking if option "-YnoDoubleDefs" is set. | ||
|
@@ -24,7 +49,11 @@ object Config { | |
/** Show subtype traces for all deep subtype recursions */ | ||
final val traceDeepSubTypeRecursions = false | ||
|
||
/** When explaining subtypes and this flag is set, also show the classes of the compared types. */ | ||
final val verboseExplainSubtype = true | ||
|
||
/** If this flag is set, take the fast path when comparing same-named type-aliases and types */ | ||
final val fastPathForRefinedSubtype = true | ||
|
||
/** When set, use new signature-based matching. | ||
* Advantantage of doing so: It's supposed to be faster | ||
|
@@ -35,12 +64,6 @@ object Config { | |
/** The recursion depth for showing a summarized string */ | ||
final val summarizeDepth = 2 | ||
|
||
/** Track dependencies for constraint propagation satisfiability checking | ||
* If turned off, constraint checking is simpler but potentially slower | ||
* for large constraints. | ||
*/ | ||
final val trackConstrDeps = true | ||
|
||
/** Check that variances of lambda arguments match the | ||
* variance of the underlying lambda class. | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a proper solution or just a hack until #321 is properly fixed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe in this particular case it helps, but in minimized case it does not:
Fails even if tailrec is in its own group.