| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
In the end, a classTag reflects the erased version of a type. The only
condition for its generation should be that the erasure is stable under
possible instantiations.
|
|\
| |
| | |
Direct representation of higher-kinded types
|
| |
| |
| |
| |
| |
| |
| | |
1. Make genericType a trait instead of a class.
2. Make TypeLambda a type proxy
3. Split underlying in TypeProxy into underlying and superType
4. Cleanups in many other places
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Taking the signature over a type with uninstantiated type variables
means that the signature can change later, once we instantiate the
type variable. We handle this by recording uninstantiated positions
of signatures and fixing them in PostTyper, when type variables are
instantiated.
- This allows to drop the kludge of "normalizing" in derivedRefinedType
Dropping this initially revealed the problems with under-determined
signatures. Now that these problems are fixed, we can drop for good.
|
| |
| |
| |
| |
| | |
- Re-introduce newHK option. Label some things that will be
removed with OLD.
|
| |
| |
| |
| |
| | |
Treat parent like refinedInfo. Introduce isBinding convenience method
in TypeBounds.
|
|/
|
|
| |
Should be erased to Object[], not Object.
|
|
|
|
|
|
|
|
| |
Forcing it led to CyclicReferences involving RefChecks.OptLevelInfo when compiling
dotc/*.scala against Tasty files. The problem was that when transforming OptLevelInfo
the backend forced a transformInfo of RefChecks in TypeErasure which filtered RefCheck's
scope to eliminate non-class type definitions. Without the tweak in this commit this
tried to make all symbols current, and so came back to OptLevelInfo.
|
| |
|
|
|
|
| |
To address #1198, we need to avoid putting symbols in ErasedValueTypes.
|
|
|
|
|
| |
Mode is used from a lot of low-level code, does not just reflect Typer info.
So it makes more sense top to place it in the core package.
|
|
|
|
|
|
| |
Unlike arrays of objects, that can be accessed as an array
of a super type of this object,
int[] cannot be accessed as an array of primitives.
|
| |
|
|
|
|
| |
It should either be erased to j.l.Object or replaced by JavaArrayType.
|
|
|
|
|
|
|
|
|
|
|
| |
This commit fixes two issues which caused us to complete Seq too early and
read it from the classpath instead of from the sources:
- Evaluting RepeatedParamClass forced Seq, this is not necessary
because the type of RepeatedParamClass is a LazyType
- TypeErasure#sigName on a Scala type always forced Seq, even if
the type is not a repeated param type.
This fixes #980.
|
|
|
|
|
|
|
|
|
| |
The fact that the annotation comes first is weird, because when I write
an annotated type it's <type> @<annotation>. Also, annotated types
are like RefinedTypes in that they derive from a parent type. And in
RefinedTypes the parent comes first.
So swapping the arguments improves consistency.
|
|
|
|
|
| |
Since we now have two forms of (almost) everything in Definitions,
might as well profit from it.
|
|
|
|
|
|
| |
TypeRef becomes Type, thus removing duplicates. Where
...Type was used in an extraction (e.g. ArrayType(...),
FunctionType(...)), we now use ...Of.
|
|
|
|
|
|
| |
Use more complicated control flow with returns instead.
sigName is likely performance critical, so some
trickiness is justified.
|
|
|
|
|
|
| |
Need to survive even if a value class does not have an
underlying type. Also: better diagnostics if sigName
goes wrong.
|
|
|
|
|
|
| |
It used to be "assertion error: NoType" whenever sigName git
a projection of a missing member. Now we find out about
what type was projected.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A TypeRef can have be unresolved, either because it refers to something that's missing
from the classpath or because of transitive self type references. Instead of crashing
in sigName, we now report the error.
Achieved by defining a new exception type, MissingType, which derives from TypeError.
This catches t7933.scala, now integrated in the neg/selfreq.scala. The problem there was
a reference to AbsSettings, which was not a member of StandardScalaSettings.this,
but was a member of the required type of AbsSettings, which itself appeared in the
required type of StandardScalaSettings. We will outlaw in the next commit such transitive
required references.
Also collapsed TypeError and FatalTypeError. It was a misnomer anyway. Fatal were those
type errors that were caught and reported!
Open: Where else we should check for unresolved NamedTypes.
|
|
|
|
|
|
| |
Replace by the pair of methods erasure/valueErasure.
The boolean parameter is still kept, but only as a
confuration parameter of the erasure objects.
|
|
|
|
|
|
|
|
|
|
| |
Thistypes erased to the underlying class. This is wrong. When seen as part of some other type,
a ThisType has to erase to the erasure of the underlying type (i.e. the erasure if the selftype
of the class). unittest-collections.scala failed with a MethodNotFound error because the erasure
was computed incorrectly.
On the other hand, a tree with a ThisType type, should keep the type, analogous to a
tree with a TermRef type.
|
|
|
|
|
|
|
| |
This method can be called from other phases than Erasure, and in most
cases we do not want the result to be semi-erased as this is an
implementation details of value classes only useful to do type
adaptation in the Erasure phase.
|
|
|
|
|
| |
Previously it didn't, because it created an ExprType, which is
illegal after erasure.
|
|
|
|
| |
()Unit translates to ()BoxedUnit not BoxedUnit.
|
| |
|
| |
|
|
|
|
|
|
| |
Arrays with wildcard arguments such as Array[_ <: Foo] where Foo is a
universal trait are now diagnosed as unbounded generic arrays and are
erased to Object.
|
|
|
|
|
|
|
|
|
|
| |
This avoids getting a runtime error when calling a Java-defined method
whose signature contains value classes. It happened because we erased
the value classes in this signature even though it comes from a
classfile.
Amusingly, this problem also exists in scalac:
<https://issues.scala-lang.org/browse/SI-9298>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
For a module class V$, the synthesized companion class method looks
like:
val companion$class: V
If V is a value class, after erasure it will look like:
val companion$class: ErasedValueType(V, ...)
This will break SymDenotation#companionClass which relies on the type of
companion$class.
The solution is to not semi-erase the type of companion$class.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are three ways to erase a value class:
- In most case, it should be semi-erased to an ErasedValueType, which will be
fully erased to its underlying type in ElimErasedValueType.
This corresponds to semiEraseVCs = true in TypeErasure.
- In a few cases, it should be erased like a normal class, so far this
seems to be necessary for:
* The return type of a constructor
* The underlying type of a ThisType
* TypeTree nodes inside New nodes
* TypeApply nodes
* Arrays
In these cases, we set semiEraseVCs = false
- When calling `sigName` it should be erased to its underlying type.
This commit implements all these cases. Note that this breaks most tests
because ElimErasedValueType has not been implemented yet, it is part of
the next commit.
|
|
|
|
|
| |
This reduces the number of objects created and speeds up subtyping tests
Also make ErasedValueType extend ValueType
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- isSemi is replaced by semiEraseVCs with a different meaning (but is
still unimplemented):
* If true, value classes are semi-erased to ErasedValueType
(they will be fully erased in ElimErasedValueType which is not
yet present in this commit).
* If false, they are erased like normal classes.
- Fix the documentation of the TypeErasure class which was wrong.
- Remove intermediate functions scalaErasureFn, scalaSigFn, javaSigFn
and semiErasureFn. It's clearer to just use erasureFn directly
instead.
- Add an optional parameter semiEraseVCs to TypeErasure#erasure which
will be used in Erasure#Typer when we need to disable semi-erasure.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit tries to disentangle the TypeErasure class and the
TypeErasure object thereby fixing #386.
- Remove the `eraseInfo` method in the TypeErasure object, use `transformInfo`
instead which takes care of using the correct instance of TypeErasure
depending on the symbol to erase.
- Remove the unused method `eraseResult` in the TypeErasure class.
- In `transformInfo`, use the correct instance of the TypeErasure class when
calling `eraseInfo`.
- In the `eraseInfo` method of the TypeErasure class, do not call the
`erasure` method of the TypeErasure object, instead use the `apply`
method of the current instance of TypeErasure.
|
| |
|
|
Use fewer length fields in type encodings.
- create new category of tags that take exactly one argument tree.
- avoid using length where a tag fits in one of theopther categories.
|