aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/typer
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix #2137: Create dummy companions for top-level objects without a real oneGuillaume Martres2017-03-231-0/+19
| | | | | | | | | | | | | | | | | Previously, we sometimes ended up forcing a companion class symbol from a previous run or from the classpath which lead to weird issues like in `false-companion`. Even if we end up not forcing such a symbol, its presence can still lead to issue: before this commit incremental compilation of `dotty-compiler-bootstrapped` was broken because we recorded a false dependency on the non-bootstrapped `dotty-compiler` jar. The added test is currently marked pending because it does not work with JUnit (which doesn't handle separate compilation), only partest. I didn't managed to get it to work right, and this won't be necessary once our testing framework is overhauled by https://github.com/lampepfl/dotty/pull/2125 anyway, so I'll just have to remember to enable this test afterwards.
* Merge pull request #2114 from dotty-staging/fix/inline-error-posGuillaume Martres2017-03-201-3/+4
|\ | | | | Fix position of errors in Inliner TreeTypeMap
| * Fix position of errors in Inliner TreeTypeMapGuillaume Martres2017-03-161-3/+4
| |
* | Fix bug in typechecking super prefix with invalid enclosing classAbel Nieto2017-03-171-19/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When typechecking class A { C.super.foo() } If C isn't an enclosing class, the compiler was throwing because of an unguarded pattern match. Fix the issue by checking for ErrorType. Tested: Verified that the example above no longer throws. Added a test.
* | Move 'invalid super qualifier' error to new error format.Abel Nieto2017-03-171-1/+1
|/ | | | | | | | | As part of https://github.com/lampepfl/dotty/issues/1589, use the new error message for static super references where the qualifier isn't a parent of the class. Tested: Added unit test.
* Remove warning from non exhaustive match in mergeCompanionDefs.Nicolas Stucki2017-03-161-1/+1
|
* Merge pull request #2079 from dotty-staging/depmeth2odersky2017-03-148-20/+62
|\ | | | | Allow inter-parameter dependencies
| * Fix unrelated typos in commentsMartin Odersky2017-03-141-1/+1
| |
| * Check there are no forward dependencies to method parametersMartin Odersky2017-03-142-1/+20
| |
| * Take parameter dependencies into accountMartin Odersky2017-03-142-5/+27
| | | | | | | | Take parameter dependencies into account when typechecking arguments.
| * Construct MethodTypes from parameter closureMartin Odersky2017-03-146-14/+15
| | | | | | | | | | To allow for dependencies between method type parameters, construct MethodTypes from a closure that maps the currently constructed MethodType to its parameter types.
* | Merge pull request #2091 from dotty-staging/fix-#2077Guillaume Martres2017-03-141-11/+1
|\ \ | |/ |/| Fix #2077: Optimization of constant conditionals
| * Fix #2077: Optimization of constant conditionalsMartin Odersky2017-03-131-11/+1
| | | | | | | | | | Move fixed logic to FirstTransform, where the other constant folding operations are also done.
* | Fix #2089: Error when compiling ParSetLike, ParSet, SetLike, in this orderGuillaume Martres2017-03-131-0/+7
|/ | | | | This fix is inspired by 6c91684, but I couldn't tell you why it works exactly, it's just something I tried.
* Fix compilation of ParSetLike by itselfGuillaume Martres2017-03-131-3/+3
| | | | | | | Before this commit, ParSetLike compiled fine as part of compileStdLib but crashed when compiled by itself because we tried to force a LazyRef while forcing the same LazyRef. This commit fixes this by being slightly more lazy where it matters.
* Merge pull request #2080 from dotty-staging/fix#-2066odersky2017-03-123-14/+24
|\ | | | | Fix #2066: Don't qualify private members in SelectionProto's...
| * 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-121-1/+3
| | | | | | | | ... unless they would be accessible in the given context.
* | Merge pull request #2078 from dotty-staging/fix-#1569-v2Guillaume Martres2017-03-121-16/+21
|\ \ | | | | | | Fix #360: Improve avoidance algorithm
| * | Improve definition and doc comment for ensureNoLeaksMartin Odersky2017-03-121-22/+21
| | | | | | | | | | | | No more try-again business necessary.
| * | Fix #1569: Improve avoidance algorithmMartin Odersky2017-03-121-4/+10
| |/ | | | | | | | | | | The essential change is that we do not throw away more precise info of the avoided type if the expected type is fully defined.
* / Fix overriding a Java method with varargsGuillaume Martres2017-03-121-0/+3
|/ | | | | | | | | | | | | | | | | | If A method like: override def foo(x: Object*) overrides a Java method, it needs to be rewritten as: def foo(x: Seq[Object]) override def foo(x: Array[Object]): Object = foo(Predef.wrapRefArray(x)) This should be handled by ElimRepeated but there were two bugs: - `addVarArgsBridge` was called at phase `thisTransformer.next`, this is too late to create the bridge since `T*` has already been rewritten as `Seq[T]` - The original method symbol needs to have the `override` flag dropped, since it doesn't override anything. Furthermore, RefChecks had to be moved after ElimRepeated, otherwise the testcase would fail the overriding checks.
* Merge pull request #2045 from dotty-staging/fix-hlist-hmapodersky2017-03-092-32/+40
|\ | | | | Fix type inference for HLists and HMaps
| * Fix handling of dependent method typesMartin Odersky2017-03-012-4/+25
| | | | | | | | | | Need to use fresh PolyParams instead of WildcardTypes if constraint is committable.
| * Systematic treatment of result types of dependent methodsMartin Odersky2017-02-282-30/+22
| | | | | | | | | | | | 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.
* | Merge pull request #2049 from ennru/ennru_RecursiveNeedsTypeodersky2017-03-091-7/+5
|\ \ | | | | | | Change "recursive/cyclic definitions needs type" errors to Message
| * | Analysis of overloaded or recursive is harder than expectedEnno Runne2017-03-071-4/+1
| | | | | | | | | | | | Fall-back to reporting "overloaded or recursive needs type".
| * | More detail in error messagesEnno Runne2017-03-051-3/+6
| | | | | | | | | | | | | | | | | | 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.
| * | Merge branch 'master' of https://github.com/lampepfl/dotty into ↵Enno Runne2017-03-023-9/+53
| |\| | | | | | | | | | ennru_RecursiveNeedsType
| * | Change 'overloaded/recursive method/value needs type' to Message (see #2026)Enno Runne2017-02-241-6/+4
| | |
* | | Merge pull request #2065 from dotty-staging/change-implicit-conv2odersky2017-03-091-5/+23
|\ \ \ | | | | | | | | Disallow subtypes of Function1 acting as implicit conversions
| * | | Drop special case around Function1Martin Odersky2017-03-081-20/+10
| | | | | | | | | | | | | | | | | | | | | | | | 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-081-5/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-091-31/+97
|\ \ \ \ | | | | | | | | | | support merging companion objects in expanded trees
| * | | | address review feedbackliu fengyun2017-03-071-29/+34
| | | | |
| * | | | 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-082-2/+1
|/ / / | | | | | | | | | | | | | | | | | | 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.
* | | Drop named type parameters in classesMartin Odersky2017-03-044-89/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 #2031 from dotty-staging/fix-#2030odersky2017-03-033-2/+3
|\ \ \ | | | | | | | | Fix #2030: Don't chain implicit conversions
| * | | Don't chain implicit conversionsMartin Odersky2017-02-273-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When inferring a view, we are not allowed to use another implicit conversion to adapt its result. Fixing this revealed another problem where we have to re-enable implicit conversions when pre-typing arguments in overloading resolution.
* | | | Allow abstract type members in objects.Nicolas Stucki2017-03-011-1/+1
| |_|/ |/| |
* | | Fix #2033: Improve handling of unresolved overloaded argumentsMartin Odersky2017-02-271-1/+10
|/ /
* | Merge pull request #1993 from dotty-staging/add-lazy-implicitsodersky2017-02-252-8/+43
|\ \ | |/ |/| Treat implicit by-name arguments as lazy values
| * Fix typosMartin Odersky2017-02-211-3/+3
| |
| * PolishingMartin Odersky2017-02-181-5/+2
| |
| * Treat implicit by-name arguments as lazy valuesMartin Odersky2017-02-172-8/+46
| | | | | | | | | | | | | | | | | | | | With the previous rules, the two test cases produce a diverging implicit expansion. We avoid this by creating for every implicit by-name argument of type T a lazy implicit value of the same type. The implicit value is visible for all nested implicit searches of by-name arguments. That way, we tie the knot and obtain a recursive lazy value instead of a diverging expansion.
* | Merge pull request #2026 from dotty-staging/fix-#2001odersky2017-02-241-15/+8
|\ \ | | | | | | Better error messages for missing type of recursive definitions