| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|/ /
| |
| |
| |
| |
| |
| | |
Previously we just returned the unapplied WildcardType which is
incorrect if the WildcardType is bounded. The proper thing to do is to
do the type application on the bounds of the WildcardType and wrap the
result in a WildcardType.
|
| | |
|
|\ \
| | |
| | | |
Change case class desugaring and decouple Products and name-based-pattern-matching
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Product pattern use to:
- have a `<: Product` requirement
- compute the arity of a pattern by looking at `N` in a `ProductN` superclass.
This commit changes `<: Product`, instead we look for a `_1` member. The arity is determined by inspecting `_1` to `_N` members instead.
---
Here another attempt to formalize Dotty's pattern-matching (base on #1805). This covers the *Extractor Patterns* [section of the spec](https://www.scala-lang.org/files/archive/spec/2.12/08-pattern-matching.html#extractor-patterns). Dotty support 4 different extractor patterns: Boolean Pattern, Product Pattern, Seq Pattern and Name Based Pattern.
Boolean Pattern
- Extractor defines `def unapply(x: T): Boolean`
- Pattern-matching on exactly `0` patterns
Product Pattern
- Extractor defines `def unapply(x: T): U`
- `N > 0` is the maximum number of consecutive (parameterless `def` or `val`) `_1: P1` ... `_N: PN` members in `U`
- Pattern-matching on exactly `N` patterns with types `P1, P2, ..., PN`
Seq Pattern
- Extractor defines `def unapplySeq(x: T): U`
- `U` has (parameterless `def` or `val`) members `isEmpty: Boolean` and `get: S`
- `S <: Seq[V]`
- Pattern-matching on any number of pattern with types `V, V, ..., V`
Name Based Pattern
- Extractor defines `def unapply(x: T): U`
- `U` has (parameterless `def` or `val`) members `isEmpty: Boolean` and `get: S`
- If there is exactly `1` pattern, pattern-matching on `1` pattern with type `S`
- Otherwise fallback to Product Pattern on type `U`
In case of ambiguities, *Product Pattern* is preferred over *Name Based Pattern*.
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | | |
Used a hardcoded string before, which caused test failures.
|
| | |
| | |
| | |
| | |
| | | |
Running the test suite with the pickling printer on showed up two more
problems which are fixed in this commit.
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Names with internal $'s are entered in package scopes only if
- we look for a name with internal $'s.
- we want to know all the members of a package scope
This optimization seems to be fairly effective. The typical range
of package scopes that need $-names is between 0 and 20%. The optimization
seems to improve execution time of all unit tests by about 3%.
Also. drop the inheritance from Iterable to Scope. The reason
is that we now need a context parameter for toList and
other Iterable operations which makes them impossible to
fit into the Iterable framework.
|
| | |
| | |
| | |
| | |
| | |
| | | |
Since we now have separate package-scopes, it's easier to have
them take into account the special role played by the scala package.
So we can drop the funky logic of `makeScalaSpecial`.
|
| | |
| | |
| | |
| | | |
and fix a bug in TreeUnpickler
|
| | |
| | |
| | |
| | | |
Prevviously they were actually unused.
|
| | |
| | |
| | |
| | | |
Mangled is like toSimpleName, except that it keeps the term/type distinction.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Once we start using unencoded operators internally, we will face the problem
that one cannot decode realiably a class file filename. We therefore turn
things around, keeping members of package scopes in mangled and encoded form.
This is compensated by (1) mangling names for lookup of such members and
(2) when unpickling from Scala 2 info or Tasty, comparing mangled names when
matching a read class or module object against a root.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Simplifies the test that the class represented by a classfile
is the class logically referenced by the file. The simplification
is needed if we want to populate package scopes with unmangled
classnames.
|
| | |
| | |
| | |
| | |
| | | |
Classfile parsing is about JVM-level names, not Scala level ones. So it
is more consistent to use mangled names throughout.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
toSimpleName is called a lot from the backend, so it makes
sense to memoize it. It would be even better to communicate
with the backend using strings, because then we would not
have to enter all these simple names in the name table.
|
| | | |
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Drop Seq implementation of name. This implementation
was always problematic because it entailed potentially
very costly conversions to toSimpleName. We now have
better control over when we convert a name to a simple
name.
|
| | |
| | |
| | |
| | | |
It fails without any test output in partest
|
| | |
| | |
| | |
| | | |
Remove unused functionality
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
1. Fix problem in fullNameSeparated
2. Revise expandedName operations
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The backend contains:
val outerName = innerClassSym.rawowner.javaBinaryName
// Java compatibility. See the big comment in BTypes that summarizes the InnerClass spec.
val outerNameModule = if (innerClassSym.rawowner.isTopLevelModuleClass) outerName.dropModule
Where `dropModule` is defined in the backend interface as:
def dropModule: Name = n.stripModuleClassSuffix
This will only work as expected if `javaBinaryName` returns a name with
proper semantic information, but before this commit we just used the
output of `fullNameSeparated` which contains no semantic information.
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Start scheme where unmangling is done by NameKinds instead of
in NameOps.
Also add namekinds for protected accessors.
|
| | | |
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Make it a method of info instead of a convention over tags, because
it's less fragile that way.
Also, add UniqueName extractor.
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
We now handle only semantic names. Also, name extractor tags
and TASTY name tags are now aligned.
|
| | | |
|