| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The change in question broke the following pattern, commonly used in name based pattern matching:
```scala
object ProdEmpty {
def _1: Int = ???
def _2: String = ???
def isEmpty = true
def get = this
}
```
This type define both `_1` and `get` + `isEmpty` (but is not <: Product). After #1938, `ProdEmpty` became eligibles for both product and name based pattern. Because "in case of ambiguities, *Product Pattern* is preferred over *Name Based Pattern*", isEmpty wouldn't be used, breaking the scalac semantics.
|
|
|
|
|
|
| |
The previous fix was too coarse. We need to move an anonymous function
in a supercall towards the call, we just have to make sure it's not
in the directly enclosing class.
|
| |
|
|\
| |
| | |
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*.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| | |
Remove unused functionality
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| | |
1. Fix problem in fullNameSeparated
2. Revise expandedName operations
|
| |
| |
| |
| |
| |
| |
| | |
Start scheme where unmangling is done by NameKinds instead of
in NameOps.
Also add namekinds for protected accessors.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| | |
We now handle only semantic names. Also, name extractor tags
and TASTY name tags are now aligned.
|
| |
| |
| |
| | |
Plus various bug fixes and filling in missing functionality
|
|\ \
| | |
| | | |
Add enum exhaustivity checking
|
| | |
| | |
| | |
| | | |
Now the algorithm is the same as in the paper.
|
| | | |
|
| | | |
|
| |/
| |
| |
| |
| | |
A new kind of child annotation that points to the term symbol representing an
enum value.
|
|/
|
|
| |
These can arise as a result of an explicit outer transform.
|
|
|
|
| |
Replace with LambdaType
|
|
|
|
| |
Replace with ParamRef
|
| |
|
| |
|
|
|
|
|
|
| |
MethodTypes have paramTypes whereas PolyTypes have paramBounds.
We now harmonize by alling both paramInfos, and parameterizing
types that will become common to both.
|
|
|
|
|
| |
and generalize MethodParam to ParamRef, and
TypeParamInfo to ParamInfo
|
|
|
|
|
|
|
|
|
|
| |
This leads to a slight overall simplification, harmonizes pickle
format with internal representation, and makes MethodTypes and
PolyTypes more similar to each other.
I believe the change is useful as it is, but in particular it is
a useful step for an eventual unification of MethodTypes and
PolyTypes.
|
|\
| |
| | |
Fix #2024: TypeApply can be a final apply of a recursive method.
|
| |
| |
| |
| |
| | |
nullary methods with type parameters were handled wrongly,
which led to absence of type application and a cryptic error message.
|
| | |
|
| | |
|
|\ \
| | |
| | | |
Make case class hashCode take class into account
|
| |\ \ |
|
| | | | |
|
| | | |
| | | |
| | | |
| | | | |
Also, update check file.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Previously, elements of the following classes had the same hash code:
case class A()
case class B()
Now they are distinguished.
|
|\ \ \ \
| |_|/ /
|/| | | |
Remove dead code in pattern matching
|
| | | | |
|
| |/ /
| | |
| | |
| | | |
Starting from unreachable case https://github.com/lampepfl/dotty/blob/f75caad00256db52bbd3310f245e51d23c2a76cc/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala#L1408
|
| | |
| | |
| | |
| | |
| | | |
Otherwise checks are done also on type projections.
Same pitfall as https://issues.scala-lang.org/browse/SI-7214
|
| | | |
|
|/ /
| |
| |
| |
| |
| | |
ThisType doesn't have a termSymbol.
And the check is actually too strong,
and not needed.
|
| | |
|