aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/transform
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #1938 from dotty-staging/named-based-patmatFelix Mulder2017-04-111-2/+2
|\ | | | | Change case class desugaring and decouple Products and name-based-pattern-matching
| * Move isProductSubType to Applications & rename to canProductMatchOlivier Blanvillain2017-04-111-1/+1
| |
| * Decouple Product and pattern-matchingOlivier Blanvillain2017-04-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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*.
* | Make extension method names semanticMartin Odersky2017-04-111-2/+3
| |
* | Lazy entering of names with internal $'s in package scopesMartin Odersky2017-04-114-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Cleanups of NameOpsMartin Odersky2017-04-111-2/+2
| | | | | | | | Remove unused functionality
* | Make outer select names semanticMartin Odersky2017-04-114-9/+12
| |
* | Avoid duplicate hashCode/equalsMartin Odersky2017-04-111-1/+2
| |
* | Make "direct names" semanticMartin Odersky2017-04-111-3/+4
| |
* | Revise qualified namesMartin Odersky2017-04-111-2/+2
| | | | | | | | | | 1. Fix problem in fullNameSeparated 2. Revise expandedName operations
* | Decentralize unmangling, add new nameKindsMartin Odersky2017-04-111-4/+6
| | | | | | | | | | | | | | Start scheme where unmangling is done by NameKinds instead of in NameOps. Also add namekinds for protected accessors.
* | Rename NameExtractor -> NameKindMartin Odersky2017-04-1113-15/+15
| |
* | Make freshName semanticMartin Odersky2017-04-118-40/+48
| |
* | Add ShadowedName and AvoidClashNameMartin Odersky2017-04-112-3/+4
| |
* | Get rid of SuperAccessor flagMartin Odersky2017-04-116-6/+9
| |
* | Get rid of ExpandedName flagMartin Odersky2017-04-114-5/+10
| |
* | Drop Config.semanticNames optionMartin Odersky2017-04-112-9/+3
| | | | | | | | | | We now handle only semantic names. Also, name extractor tags and TASTY name tags are now aligned.
* | Add default getter namesMartin Odersky2017-04-112-6/+9
| | | | | | | | Plus various bug fixes and filling in missing functionality
* | Merge pull request #2197 from dotty-staging/add-enum-exhaustivenessodersky2017-04-103-100/+76
|\ \ | | | | | | Add enum exhaustivity checking
| * | simplify exhaustivity check using ConstantTypeliu fengyun2017-04-061-49/+11
| | | | | | | | | | | | Now the algorithm is the same as in the paper.
| * | remove obsolete codeliu fengyun2017-04-061-9/+0
| | |
| * | exhaustivity support for enumsliu fengyun2017-04-062-51/+68
| | |
| * | Add child annotations for enum valuesMartin Odersky2017-04-062-4/+10
| |/ | | | | | | | | A new kind of child annotation that points to the term symbol representing an enum value.
* / Fix #2188: Do cbn transform also on SelectsMartin Odersky2017-04-091-0/+3
|/ | | | These can arise as a result of an explicit outer transform.
* Eliminate MethodOrPolyMartin Odersky2017-04-061-1/+1
| | | | Replace with LambdaType
* Eliminate ParamTypeMartin Odersky2017-04-061-1/+1
| | | | Replace with ParamRef
* replace derived{Method,Poly}Type with derivedLambdaTypeMartin Odersky2017-04-066-11/+11
|
* Rename PolyParam --> TypeParamRefMartin Odersky2017-04-062-2/+2
|
* Harmonize paramTypes and paramBoundsMartin Odersky2017-04-0610-21/+21
| | | | | | MethodTypes have paramTypes whereas PolyTypes have paramBounds. We now harmonize by alling both paramInfos, and parameterizing types that will become common to both.
* Break out functionality from MethodTypeMartin Odersky2017-04-062-3/+3
| | | | | and generalize MethodParam to ParamRef, and TypeParamInfo to ParamInfo
* Encode variances in parameter namesMartin Odersky2017-04-061-2/+2
| | | | | | | | | | 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.
* Merge pull request #2025 from dotty-staging/fix-2024Nicolas Stucki2017-04-051-0/+4
|\ | | | | Fix #2024: TypeApply can be a final apply of a recursive method.
| * Fix #2024: TypeApply can be a final apply of a recursive method.Dmitry Petrashko2017-03-081-0/+4
| | | | | | | | | | nullary methods with type parameters were handled wrongly, which led to absence of type application and a cryptic error message.
* | Addresses review commentsAllan Renucci2017-04-042-8/+8
| |
* | Fixes @unchecked warningsAllan Renucci2017-04-032-4/+4
| |
* | Merge pull request #2159 from dotty-staging/fix-hashcodeDmitry Petrashko2017-04-031-2/+3
|\ \ | | | | | | Make case class hashCode take class into account
| * \ Merge branch 'master' into fix-hashcodeFelix Mulder2017-04-021-11/+6
| |\ \
| * | | Use full name of case classes for hashingMartin Odersky2017-03-311-2/+3
| | | |
| * | | Optimize hashCode computationMartin Odersky2017-03-311-2/+2
| | | | | | | | | | | | | | | | Also, update check file.
| * | | Make case class hashCode take class into accountMartin Odersky2017-03-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, elements of the following classes had the same hash code: case class A() case class B() Now they are distinguished.
* | | | Merge pull request #2157 from dotty-staging/patmat-dead-codeFelix Mulder2017-04-021-109/+3
|\ \ \ \ | |_|/ / |/| | | Remove dead code in pattern matching
| * | | Remove unreachable `tupleExtractor` methodOlivier Blanvillain2017-03-301-22/+1
| | | |
| * | | Remove dead code from pattern matcherOlivier Blanvillain2017-03-301-87/+2
| |/ / | | | | | | | | | Starting from unreachable case https://github.com/lampepfl/dotty/blob/f75caad00256db52bbd3310f245e51d23c2a76cc/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala#L1408
* | | PatMat, Outerchecks: Check outers for selections from singleton type.Dmitry Petrashko2017-03-301-3/+4
| | | | | | | | | | | | | | | Otherwise checks are done also on type projections. Same pitfall as https://issues.scala-lang.org/browse/SI-7214
* | | PatMat: get rid of unnecessary forwarderDmitry Petrashko2017-03-301-8/+2
| | |
* | | Fix #2165, emit outerChecks on ThisTypeDmitry Petrashko2017-03-301-2/+2
|/ / | | | | | | | | | | ThisType doesn't have a termSymbol. And the check is actually too strong, and not needed.
* | Only use shadowed when necessaryMartin Odersky2017-03-201-7/+8
| |
* | Use shadowing to reference inherited accessors.Martin Odersky2017-03-201-3/+9
| | | | | | | | | | | | Normal references won't work since the referenced accessor has the same name as a private name in the class defining the forwarder. This showed up as pickling failures under separate compilation.
* | Fix #2084.Dmitry Petrashko2017-03-201-5/+12
| |
* | Merge pull request #2058 from dotty-staging/fix-2054liu fengyun2017-03-182-2/+8
|\ \ | | | | | | Fix #2054