aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/typer/Implicits.scala
Commit message (Collapse)AuthorAgeFilesLines
* Merge MethodType and PolyType functionality where possibleMartin Odersky2017-04-061-2/+1
| | | | | | Two benefits: (1) less code. (2) finding subtle bugs about parameter dependent method types. By merging with PolyTypes we are forced to take parameter dependencies into account.
* Further refactoringsMartin Odersky2017-04-061-3/+3
| | | | | - Use TypeLambda instead of PolyType. - Further harmonize factory operations
* Harmonize paramTypes and paramBoundsMartin Odersky2017-04-061-4/+4
| | | | | | MethodTypes have paramTypes whereas PolyTypes have paramBounds. We now harmonize by alling both paramInfos, and parameterizing types that will become common to both.
* Alternative fix of #2066.Martin Odersky2017-03-121-2/+8
| | | | | Now we never match `? { name: T }` with types that have only a private `name` member. This is what scalac does, too.
* 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.
* Don't chain implicit conversionsMartin Odersky2017-02-271-0/+1
| | | | | | | 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.
* Merge pull request #1993 from dotty-staging/add-lazy-implicitsodersky2017-02-251-7/+42
|\ | | | | 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-171-7/+45
| | | | | | | | | | | | | | | | | | | | 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.
* | Unrelated cleanup: Make SearchResult sealed.Martin Odersky2017-02-151-1/+1
|/
* Merge pull request #1921 from dotty-staging/fix-#1907odersky2017-02-081-19/+30
|\ | | | | Fix #1907: Improve error message
| * Disallow taking a class tag of Nothing or Null.Martin Odersky2017-02-011-0/+2
| | | | | | | | | | | | | | | | It seems in most cases this leads to weird behavior and cause confusing error messages later. It also means we cannot create an Array[Nothing], except by passing the classtag explicitly.
| * Handle Array classtags in the same way as othersMartin Odersky2017-02-011-19/+28
| | | | | | | | | | | | The previous implicit definition of arrayTag in DottyPredef priorities arrayTag over all other classtag searches, which led to surprising results in `i1907a.scala`.
| * Implement SearchResult.showMartin Odersky2017-01-311-4/+8
| |
| * Avoid recomputation of companionRefsMartin Odersky2017-01-311-5/+5
| | | | | | | | | | | | | | | | | | | | The previous condition for caching companionRefs contained a condition result.companionRefs.forall(implicitScopeCache.contains) which was always false because we cache types in `implicitCodeCache`, not companion refs. The new logic fixes this and does not need a second traversal because it is integrated in `iscopeRefs`.
* | Merge pull request #1953 from dotty-staging/fix-wildapproxodersky2017-02-081-3/+3
|\ \ | | | | | | Fix to wildapprox
| * | Fix wildApprox functionMartin Odersky2017-02-071-3/+3
| |/ | | | | | | | | | | | | | | | | | | f-bounded-case-class.scala exhibited a StackOverflow in wildApprox before the fixes. The problem was due to F-bounds. Note: wildApprox is performance critical. I ran timed-bootstrap-repeated a couple of times to verify that the changes did not affect runtimes in significant ways. We should also watch out for a slowdown in the benchmark tests.
* | Implement SearchResult.showMartin Odersky2017-02-081-4/+8
| |
* | Avoid recomputation of companionRefsMartin Odersky2017-02-081-5/+5
|/ | | | | | | | | | The previous condition for caching companionRefs contained a condition result.companionRefs.forall(implicitScopeCache.contains) which was always false because we cache types in `implicitCodeCache`, not companion refs. The new logic fixes this and does not need a second traversal because it is integrated in `iscopeRefs`.
* Fix another NPE when compiling under -Yno-importsMartin Odersky2017-01-161-8/+10
|
* Fix NPE in ImplicitsMartin Odersky2017-01-161-3/+11
| | | | | We got on NPE when compiling the collection strawman under -Yno-imports. We did not preview that the contextual implicit scope stack could be empty.
* Move `eqNullable` check to `assumedCanEqual`Felix Mulder2016-12-191-20/+12
|
* Fix #1793: allow multiversal comparisons between Null and XFelix Mulder2016-12-191-2/+20
|
* Don't look at nesting for implicit resolution under Scala2 mode.Martin Odersky2016-12-171-1/+6
|
* Create implicit closures to math expected implicit functionsMartin Odersky2016-12-171-3/+5
| | | | | When the expected type is an implicit function, create an implicit closure to match it.
* Take nesting into account when ranking implicitsMartin Odersky2016-12-171-24/+40
| | | | | | This will need a spec change. It's necessary in order not to confuse synthetic implicits with each other or with explicit ones in the environment.
* Avoid recomputation of companionRefsMartin Odersky2016-11-241-31/+30
| | | | | | | When tracing i1639.scala it became apparent that we compute a lot of companion refs. This commit avoids this by better book-keeping what is valid and what is not and more aggressive caching.
* Better reporting of nested implicit failuresMartin Odersky2016-11-241-8/+37
| | | | | Error messages of nested implicit failures are now reported with the top-level message if -explaintypes is set.
* Move compiler and compiler tests to compiler dirFelix Mulder2016-11-221-0/+844