| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In particular:
- get rid of envelope, it's too complicated and hides too many errors
- check that everywhere in parsed trees the position range of a parent
node contains the position ranges of its children.
- check that all non-empty trees coming from parser have positions.
The commit contains lots of fixes to make these checks pass.
In particular, it changes the scheme how definitions are positioned.
Previously the position of a definition was the token range of the
name defined by it. That does obviously not work with the parent/children
invariant. Now, the position is the whole definition range, with the
point at the defined name (care is taken to not count backticks).
Namer is changed to still use the token range of defined name as the
position of the symbol.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The special case:
case stripped: TypeRef =>
stripped.symbol.is(BaseTypeArg)
is wrong because you might still want to reduce applications involving
TypeRefs which are not base class parameters, like in:
class Foo[A]
type Alias[X] = Foo[X]
val x: Alias[Int] = ???
`Alias` is a TypeRef so before this commit `Alias[Int]` was never reduced
to `Foo[Int]`. It should have been:
case stripped: TypeRef if stripped.symbol.is(BaseTypeArg) =>
true
But even this is incorrect: it assumes that we can always safely reduce HK
applications involving base class parameters, this is not the case when
the parameter kind is different from the rhs kind as illustrated by
`i1181c.scala`. We fix this by simply dropping the special case.
|
|
|
|
|
| |
Previous logic could only handle classes as constructors.
Also, address other reviewers comments.
|
|
|
|
|
|
|
|
|
| |
Beta-reduce only if `Config.simplifyApplications` is true.
Turning off beta-reduction revealed two problems which are
also fixed in this commit:
1. Bad treatement of higher-kinded argyments in cyclicity checking
2. Wrong variance for higher-kinded arguments in TypeAccumulator
|
|
|
|
|
| |
Allows us to drop also the involved knownHK method. Lots of other
cleanups.
|
|
|
|
|
| |
Eliminate sameParams, add comments.
Also, minor cleanups elsewhere.
|
|
|
|
|
|
|
|
|
|
| |
Remove the code that implemented the encoding of hk types
using refinements.
Drop the notion that RefinedTypes can be type parameters. This is
no longer true under the new representation.
Also, refactoring MemberBinding -> TypeParamInfo
|
|
|
|
|
|
|
| |
The deleted assertion could fail for code that was
erroneous.
- Enable new hk scheme.
|
|
|
|
|
| |
- Re-introduce newHK option. Label some things that will be
removed with OLD.
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Simplify RefinedType
- Drop recursive definition of RefinedThis - this is now
taken over by RecType.
- Drop RefinedThis.
- Simplify typeParams
The logic avoiding forcing is no longer needed.
- Remove unused code and out of date comments.
|
|
|
|
| |
Optionally, check kinds of operands of & and | match.
|
|
|
|
|
|
|
| |
For the moment under newHK flag.
- avoid crasher in derivedTypeParams (NamedTypes don't always have symbols)
- Revise logic in type comparer for new HK scheme
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
With the new approach to matching it is no longer sound.
We always have to match infos anyway to be sure.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It turns out that asSeenFrom can produce types
that get projected with $apply but that are not
higher-kinded. An exampple failure is in Iter3,
andother in scala.collection.immutable.Map (which is
now part of the test suite).
We now detect that situation, and eta expand the
projected type in `derivedSelect`, this will
force a subssequent `lookupRefined` which will give
the desired normalized type.
Also added is a configurable test that checks that
$apply projected tyeps are in fact higher-kinded.
|
|
|
|
|
|
|
| |
Checking that constraints are closed caused cyclic reference exceptions in
DottyBackedInterface. What's worrying is that these were seemingly not checked
by the checkin tests. Or maybe there is some dependcy on compilation order that triggers
the erros only in my setup.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
We want to establish the invariant (optionally checked by assertNoSkolems)
that symbols do not contain skolemized types as their info. This avoids unsoundness situations
where a skolem gets exported as part if the result type of a method, so different instantiations
look like their are the same instance.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adds IterableSelfRec.scala which caused lockup of the compiler.
After a lot of work the problem was determined to be polyomial or
exponential behavior of the compiler when executing findMember
on refined types that contain several bindings where the
resutling & causes a recursive invokation of findMember with
the same name. We do have a stop for this now, but if the
stop comes too late the runtime will grow very fast.
Problem addressed by kiccking in earlier with the stopping logic.
|
|
|
|
| |
It's a more logical home for them than the Context object.
|
|
|
|
|
| |
I scanned the main sources with IntellIJ's spell checker and
corrected what showed up.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Only run if a config option is set.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
See comment for an example what changes.
|
|
|
|
|
| |
A configuratin now decides whether fast path is taken or not. That way
we can more easily test either way if something goes wrong.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Now that new scheme works we can drop the alternative.
|
| |
|
|
|
|
|
|
| |
Move flag that throws exception on deep subtyping stacks from Config varianble to setting.
Disable setting for core-pickling which had a deep subtype failure after pattern matcher
was integrated. Todo: Figure out why the subtype stack got so deep.
|
|
|
|
| |
testOnly dotc.tests
|
|
|
|
|
|
|
|
| |
- Some types are different when erased (e.g. prefixes are NoPrefix)
- Some types are forbidden when erased. Put in assertions to check that fact.
Also, some renaming and doc comments to make creation of TermRefs and TypeRefs
clearer.
|
|
|
|
|
| |
Make sure that Lambda Arg refinements have the same variance as the Lambda classes
they instantiate. Controlled by a Config parameter.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The main problem with TermRef handling was that signatures were not always tracked correctly.
New invariant: A TermRef that points to a symbol is always a TermRefWithSig, and the signature
is the one of the corresponding member.
We achieve this by sometimes generating a new TermRefWithSig if a TermRef gets a denotation.
One possible simplification would be to always store a signature in a TermRef.
There's still a problem in TermRefWithSig#newLikeThis, which currently works only if the previously stored
denotation references a symbol. We will need to generalize JointRefDenotation to contain multiple symbols for
a complete fix.
|
|
|
|
|
|
| |
Added general way to produce summaries when shwowing trees or types.
Summaries have limited, configrable recusion depth.
fix showSummary
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Need to pass a current context to be able to find instances of typevars.
|
| |
|