aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Constraint.scala
Commit message (Collapse)AuthorAgeFilesLines
* Clean up config.Printers importsOlivier Blanvillain2016-09-231-1/+1
| | | | And remove the not used Printer#echo
* Implement constraint mergingMartin Odersky2016-08-261-0/+3
| | | | Not used yet, but we might use it as an alternative to typedArg invalidation later.
* New string infterpolatorsMartin Odersky2016-08-161-1/+1
| | | | | | Roll `sm` and `i` into one interpolator (also called `i`) Evolve `d` to `em` interpolator (for error messages) New interpolator `ex` with more explanations, replaces disambiguation.
* Address reviewers commentsMartin Odersky2016-07-111-1/+1
|
* Less eager removal of type parameters from constraintMartin Odersky2016-07-111-5/+4
| | | | | | | | | | | | | | | | | Previously, a unified or otherwise instantiated type parameter would be removed from the constraint, i.e. if it was the last parameter of its polytype to be instantiated, the polytype would be dropped. This is a potential problem since it means that the alias `param = instance` is forgetten whereas we might still need it in the same subtype test sequence. The solution is to wait with cleaning up polytypes until all associated type variables are fully instantiated. This change uncovered another bug, where we failed to follow an existing instantiation when adding to a constraint. This manifested itself in deep subtype errors for run/colltest1 and some others.
* Refactoring of PolyType and TypeLambdaMartin Odersky2016-07-111-5/+5
| | | | | | | Make them each inherit from common BaseType GenericType. That way we avoid inheriting accidentally stuff from PolyType in TypeLambda. Also, Fix adaptation of type lambdas. Don't confuse them with PolyTypes.
* Avoid junk produced by Constraint#replace.Martin Odersky2015-06-221-0/+3
| | | | | | | | | | | | | | There were two instances where a constraint undergoing a replace would still refer to poly params that are no longer bound after the replace. 1. In an ordering the replaced parameters was n ot removed from the bounds of the others. 2. When a parameter refers to the replaced parameter in a type, (not a TypeBounds), the replaced parameter was not replaced. We now have checking in place that in globally committable typer states, TypeVars are not instantiated to PolyParams and (configurable) that constraints of such typer states are always closed. Fixes #670.
* Remove trailing spaces in Dotty source.Dmitry Petrashko2015-04-091-27/+27
|
* Fixups taking into account reviewer's comments.Martin Odersky2015-01-271-2/+4
|
* Added explanation to comment.Martin Odersky2015-01-241-1/+2
|
* Replace only substitutes top-level types.Martin Odersky2015-01-241-1/+2
| | | | See comment in OrderingConstraint#replace.
* New constraint implementation: OrderingConstraintMartin Odersky2015-01-241-1/+1
| | | | | | | This is one both a bit simpler and a faster than TrackingConstraint. Main change is to replace the 2-d bitmap for ordering with two SimpleMaps which record for each parameter the smaller and greater parameters. This is faster in practice because the ordering relation is sparse.
* New constraint method: narrowBoundMartin Odersky2015-01-231-0/+6
| | | | | Allows to merge the functionality of addOneLowerBound and addOneUpperBound in ConstraintHandling.
* New constraint handlingMartin Odersky2015-01-181-52/+39
| | | | | | | | New constraint handling scheme using constraints that distinguish more between parameter and non-parameter bounds and which track parameter bounds separately. This allows a co-inductive formulation of satisfiability checking without fishy cyclicity checks. It should also scale better for long chains of dependent type variables.
* Added alternative TrackingConstraintMartin Odersky2015-01-131-5/+5
| | | | This is an alternative low-level constraint implementation.
* Made constraint data structures pluggable.Martin Odersky2015-01-121-441/+95
| | | | | Factored out interface for constraints. Current implementation: NaiveConstraint. Preparing for a more efficient one.
* Add transitive check for cycles in constraints.Martin Odersky2015-01-081-0/+38
|
* Create TypeAlias subclass of TypeBouundsMartin Odersky2014-12-101-2/+4
| | | | Specialize hash consing of type aliases.
* Adding dependency tracking to constraint satisfactionMartin Odersky2014-05-081-8/+142
| | | | | | | | The previous scheme checked all constraint bounds twice everytime the bounds for a parameter in a constraint were changed. The new scheme, which can be disabled by unsetting `Config.trackContrDeps`, only checks those cbounds that directly or indirectly mention the changed parameter.
* Tightened satisfiablity checks.Martin Odersky2014-05-081-0/+12
| | | | | | Satisfiability was too loose before. It is noww tightened. We check that the lower bounds of all constrained parameters represent a solution to the constraint. To make the check pass we have to first propagate the constraint by re-verifying all bounds.
* Fix of TyperState#instTypeMartin Odersky2014-05-081-1/+4
| | | | | | | | If a type variable TV1 is instantiated to a poly param, and the poly param is itself accomanied by a type variable TV2, then the instance of TV1 should be TV2 and not the original poly param. Otherwise we lose instantiations. This is demonstrated by running dotc on the .scala files in the dotc directory itself with option -Ycheck.
* Improve test infrastructureMartin Odersky2014-03-101-1/+2
| | | | | | | | | 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.
* Performance improvement: Cache uninstatiated typevars in constraintsMartin Odersky2014-02-211-12/+17
| | | | | | | Pro: Much faster to iterate through uninstantiated type variables Con: Constraints can no longer be value classes. Still this seems to give a net win of ~2%.
* Move maxConstraint computation to RunInfo to avoid references to stale symbols.Martin Odersky2014-02-091-9/+10
|
* Fixes to constraint handling.Martin Odersky2014-01-261-10/+48
| | | | | | | | 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.
* When instantiating a type var, need to map back from polyparams to typevars.Martin Odersky2014-01-131-0/+9
|
* New subtype constraint maintenance algorithm.Martin Odersky2014-01-071-29/+26
| | | | | | | | | | 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.
* Check that constraints are not cyclic, and avoid cycles when replacing ↵Martin Odersky2013-12-311-4/+44
| | | | parameters.
* SimpleMap.foreachKey -> foreachBindingMartin Odersky2013-11-291-9/+9
|
* Tightening (constraint contains param) conditionMartin Odersky2013-11-281-1/+1
|
* Dropping cinsistency checking logic from typerstates.Martin Odersky2013-11-221-2/+10
| | | | Because of the new typerstate design, we can enforce most invariants by design, or in a purely local manner. We can therefore drop the checkConsistent checks and replace them with much more lightweight assertions that make sure that only committable states are committed and only committable states can create typevars.
* Consolidation of TyperState and ConstraintMartin Odersky2013-11-211-28/+90
| | | | Removing undetVars and instTypes as separately assignable fields. This is better for maintaining invariants by design.
* Better encapsulation for constraints.Martin Odersky2013-11-201-29/+40
| | | | The fact that constraints are maps from PolyTypes to Array[Type] is now hidden form the restr of the program (Or, almost; unfortunately value classes force us to expose the parameter, but we renamed it to a name which is typically used for private data).
* Splitting constraint.appky into at, bounds, contains.Martin Odersky2013-11-201-2/+7
| | | | Motivation: Keep usages separate, prepare for larger constraint refactoring.
* More tweaksMartin Odersky2013-11-201-0/+6
|
* Reporting max constraintMartin Odersky2013-11-101-19/+23
| | | | Instead of throwing an exception if SImpleMap size goes over some threshold, we now report the largest constraint encountered in a run.
* Bug fixes and improvements in error diagnostics.Martin Odersky2013-09-161-5/+10
| | | | Main refactoring: lub/glb moves to type comparers.
* Improvements in implicits error reportingMartin Odersky2013-09-061-2/+2
| | | | Plus a few bugfixes for implicits
* File renameMartin Odersky2013-09-051-0/+117