aboutsummaryrefslogtreecommitdiff
path: root/compiler/src
Commit message (Collapse)AuthorAgeFilesLines
* Alternative fix of #2066.Martin Odersky2017-03-123-16/+24
| | | | | Now we never match `? { name: T }` with types that have only a private `name` member. This is what scalac does, too.
* Fix #2066: Don't qualify private members in SelectionProto's...Martin Odersky2017-03-123-3/+9
| | | | ... unless they would be accessible in the given context.
* Merge pull request #2070 from dotty-staging/fix/erasedLubodersky2017-03-091-4/+8
|\ | | | | Fix bug in erasedLub leading to incorrect signatures
| * Fix bug in erasedLub leading to incorrect signaturesGuillaume Martres2017-03-081-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this commit, the added testcase failed in a strange way: 14 | def bla(foo: Foo) = orElse2(identity).apply(foo) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |value of type <nonsensical><notype></nonsensical> does not take parameters This happened because the TermRef for the apply method had an incorrect signature, therefore its underlying type was NoType. According to the documentation of `erasedLub`, the erasure should be: "a common superclass or trait S of the argument classes, with the following two properties: S is minimal: no other common superclass or trait derives from S] S is last : in the linearization of the first argument type `tp1` there are no minimal common superclasses or traits that come after S. (the reason to pick last is that we prefer classes over traits that way)." I'm not convinced that the implementation satisfies either of these two properties, but this commit at least makes S closer to being minimal by making sure that the last best candidate never derives from it.
* | Merge pull request #2068 from dotty-staging/fix-#2064odersky2017-03-091-8/+7
|\ \ | | | | | | Fix #2064: Avoid illegal types in OrDominator
| * | Fix commentMartin Odersky2017-03-081-2/+3
| | |
| * | Better fixMartin Odersky2017-03-082-7/+5
| | | | | | | | | | | | | | | `superType` should never return a `TypeBounds` in the first place. This commit makes sure it doesn't.
| * | Fix #2064: Avoid illegal types in OrDominatorMartin Odersky2017-03-081-1/+1
| | | | | | | | | | | | | | | Need to skip type bounds in `underlying` chain, since TypeBounds is not a legal operand type for OrType.
* | | Merge pull request #2045 from dotty-staging/fix-hlist-hmapodersky2017-03-0911-63/+100
|\ \ \ | | | | | | | | Fix type inference for HLists and HMaps
| * | | Adress reviewers commentsMartin Odersky2017-03-031-1/+1
| | | |
| * | | More testsMartin Odersky2017-03-021-1/+1
| | | | | | | | | | | | | | | | and a typo fixed
| * | | Make alignArgsInAnd safe and turn it on by defaultMartin Odersky2017-03-015-28/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Turned out hmaps.scala requires the arg alignment to compile. So we have our first counterexample that we cannot drop this hack. Now it is made safe in the sense that no constraints get lost anymore.
| * | | Fix handling of dependent method typesMartin Odersky2017-03-015-10/+27
| | | | | | | | | | | | | | | | | | | | Need to use fresh PolyParams instead of WildcardTypes if constraint is committable.
| * | | Don't align aliases in refined types by defaultMartin Odersky2017-02-282-14/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We previously tried to force S1 and S2 be the same type when encountering a lub like `T1 { A = S1 } & T2 { A = S2 }`. The comments in this commit explain why this is unsound, so this rewrite is now made subject to a new config option, which is off by default. I verified that the new behavior does not affect the performance of the junit tests.
| * | | Systematic treatment of result types of dependent methodsMartin Odersky2017-02-283-31/+32
| | | | | | | | | | | | | | | | | | | | | | | | We approximate dependencies to parameters by Wildcards. This was already done in one place, is now done in other places as well, instead of doing nothing for dependent methods.
| * | | Constrain results of dependent implicitsMartin Odersky2017-02-281-14/+9
| | | | | | | | | | | | | | | | | | | | No reason why we should not - normalize handles implicit methods just fine. This fixes type errors in test HLists.scala.
| * | | Fix printing of refined applied typesMartin Odersky2017-02-282-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | If an applied type has a refinement, it was printed before as one large refinement type including the type parameter bindings.
* | | | Merge pull request #2049 from ennru/ennru_RecursiveNeedsTypeodersky2017-03-094-9/+57
|\ \ \ \ | | | | | | | | | | Change "recursive/cyclic definitions needs type" errors to Message
| * | | | Analysis of overloaded or recursive is harder than expectedEnno Runne2017-03-073-23/+14
| | | | | | | | | | | | | | | | | | | | Fall-back to reporting "overloaded or recursive needs type".
| * | | | More detail in error messagesEnno Runne2017-03-054-8/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Split error messages for recursive method and overloaded method needs type into two (but did not solve the analysis which to show). Make CyclicReference type error construct corresponding error message.
| * | | | Explanations for recursive/cyclic type requirementsEnno Runne2017-03-041-21/+23
| | | | |
| * | | | Merge branch 'master' of https://github.com/lampepfl/dotty into ↵Enno Runne2017-03-0214-42/+144
| |\ \ \ \ | | | | | | | | | | | | | | | | | | ennru_RecursiveNeedsType
| * | | | | Change 'overloaded/recursive method/value needs type' to Message (see #2026)Enno Runne2017-02-243-6/+35
| | | | | |
* | | | | | Merge pull request #2065 from dotty-staging/change-implicit-conv2odersky2017-03-092-5/+27
|\ \ \ \ \ \ | | | | | | | | | | | | | | Disallow subtypes of Function1 acting as implicit conversions
| * | | | | | Drop special case around Function1Martin Odersky2017-03-082-20/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now only Scala2 mode treats Function1's as implicit conversions. Instead we introduce a new subclass ImplicitConverter of Function1, instances of which are turned into implicit conversions.
| * | | | | | Fix condition logicMartin Odersky2017-03-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | I introduced an error in the refactoring two commits ago.
| * | | | | | Keep old behavior under -language:Scala2Martin Odersky2017-03-081-2/+8
| | | | | | |
| * | | | | | Disallow subtypes of Function1 acting as implicit conversionsMartin Odersky2017-03-082-5/+29
| | |_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new test `falseView.scala` shows the problem. We might create an implicit value of some type that happens to be a subtype of Function1. We might now expect that this gives us an implicit conversion, this is most often unintended and surprising. See the comment in Implicits#discardForView for a discussion why we picked the particular scheme implemented here.
* | | | | | Merge pull request #2057 from dotty-staging/merge-companionodersky2017-03-092-31/+98
|\ \ \ \ \ \ | | | | | | | | | | | | | | support merging companion objects in expanded trees
| * | | | | | address review feedbackliu fengyun2017-03-072-29/+35
| | | | | | |
| * | | | | | support merging companion objects in expanded treesliu fengyun2017-03-071-31/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previous implementation is problematic when there are multiple transforms before typer: 1. There might be objects needing merging that only exist in the expanded trees, which cannot be handled by the previous algorithm. 2. There may be companion object and class defined only in the expanded trees, the previous algorithm doesn't create links for them. This PR simplifies the companion object merging logic and fixes the problems above. In fact, this PR supports multiple pre-typer transform during expansion. The protocol is that the expansion of a MemberDef is either a flattened thicket or a non-thicket tree.
* | | | | | | Fix #2067: Compute defKind at Typer, not NamerMartin Odersky2017-03-086-24/+19
| |/ / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's hard to predict for defKind all the desugarings that can be applied to a definition. Better to do it once the desugarings have been applied. NoInit and PureInterface are both tested only after Typer, so it's OK to delay their initialization until regular Typer.
* | | | | | Don't set PureInterface when a default param is presentGuillaume Martres2017-03-081-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The default param will be desugared into a method with a body, so setting PureInterface would be wrong. The enclosed test previously failed with a pickling difference, because the unpickler correctly decided to not set the PureInterface flag since it saw the default param method. This fixes the tasty_dotc_util which failed since the last commit because FreshNameCreator was now incorrectly recognized as a PureInterface.
* | | | | | Remove unused methods depending on scala-reflectGuillaume Martres2017-03-081-5/+0
| | | | | |
* | | | | | Add Scala2Flags to replace our use of scala-reflect FlagsGuillaume Martres2017-03-082-18/+110
| | | | | |
* | | | | | Remove uses of StringOps from scala-reflectGuillaume Martres2017-03-086-8/+18
| | | | | |
* | | | | | Add FatalError from scala.reflectGuillaume Martres2017-03-082-3/+3
| | | | | |
* | | | | | Add PickleFormat from scala-reflectGuillaume Martres2017-03-083-2/+229
| | | | | |
* | | | | | Remove uses of Collections from scala-reflectGuillaume Martres2017-03-083-10/+5
| | | | | |
* | | | | | Use Chars object from dotty instead of scala.reflectGuillaume Martres2017-03-077-8/+9
| | | | | |
* | | | | | Remove unused scala.reflect importsGuillaume Martres2017-03-075-6/+0
| |_|_|_|/ |/| | | |
* | | | | Merge pull request #2061 from dotty-staging/fix/overcompilation-apiGuillaume Martres2017-03-071-2/+2
|\ \ \ \ \ | | | | | | | | | | | | Fix incremental overcompilation due to instabilities
| * | | | | Fix incremental overcompilation due to instabilitiesGuillaume Martres2017-03-071-2/+2
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The output of ExtractAPI should be stable, otherwise sbt might incorrectly conclude that some API changed because its hash is different, even though the source hasn't changed. This commit fixes two cases where this might happen: - package prefixes in NamedTypes are unstable, we already worked around this by normalizing them, but only for classes, we now always do it. - We use a simplified representation for `_ >: Nothing <: Any`, this is now checked using `isDirectRef` instead of referential equality on types since there is more than one way to represent `Nothing` and `Any`. Both of these issues were found while compiling dotty with `dotty-compiler-bootstrapped/compile` and making small changes.
* | | | | Merge pull request #2059 from dotty-staging/fix/inline-EmptyTreeodersky2017-03-071-2/+5
|\ \ \ \ \ | |/ / / / |/| | | | Fix #2056: Backend crash when inlined method contains try
| * | | | Fix #2056: Backend crash when inlined method contains tryGuillaume Martres2017-03-071-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In various places we do "case EmptyTree =>", since Tree#equals uses reference equality this means that EmptyTree should never be copied, otherwise some other code path will be taken.
* | | | | Merge pull request #2053 from niktrop/splitOnCharFelix Mulder2017-03-061-1/+3
|\ \ \ \ \ | | | | | | | | | | | | fixed PatternSyntaxException on Windows
| * | | | | fixed PatternSyntaxException on WindowsNikolay.Tropin2017-03-061-1/+3
| | |_|/ / | |/| | |
* | | | | FixesMartin Odersky2017-03-052-15/+1
| | | | | | | | | | | | | | | | | | | | | | | | | (1) Drop unused error message (2) Drop test which is now illegal
* | | | | Drop named type parameters in classesMartin Odersky2017-03-0412-223/+42
| |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Drop the [type T] syntax, and what's associated to make it work. Motivation: It's an alternative way of doing things for which there seems to be little need. The implementation was provisional and bitrotted during the various iterations to introduce higher-kinded types. So in the end the complxity-cost for language and compiler was not worth the added benefit that [type T] parameters provide. Noe that we still accept _named arguments_ [A = T] in expressions; these are useful for specifying some parameters and letting others be inferred.
* | | | Merge pull request #2039 from dotty-staging/add-refined-assertNicolas Stucki2017-03-031-0/+3
|\ \ \ \ | | | | | | | | | | Add assert that refine infos are legal wrt refined names