aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer
Commit message (Collapse)AuthorAgeFilesLines
* Fix #657: Add scala.Dynamic support.Nicolas Stucki2016-07-075-7/+106
|
* Add straightforward fix to #1308jvican2016-07-011-1/+1
|
* Merge pull request #1226 from dotty-staging/static-fixesDmitry Petrashko2016-06-221-1/+1
|\ | | | | Multiple fixes to @static
| * Fix Ycheck: allow assigning fields in static constructors.Dmitry Petrashko2016-06-071-1/+1
| |
* | Merge pull request #1309 from felixmulder/topic/fix#1307Dmitry Petrashko2016-06-221-0/+4
|\ \ | | | | | | Fix issue with GADT not typechecking without bind in match
| * | Move GADT check to `typeTyped`Felix Mulder2016-06-071-4/+5
| | |
| * | Fix issue with GADT not typechecking without bind in matchFelix Mulder2016-06-061-1/+4
| |/
* / better handling of overloaded extractorsliu fengyun2016-06-201-2/+2
|/
* Overloading resolution: prefer directly applicable methodsGuillaume Martres2016-06-031-4/+10
| | | | | | | | | | | If directly applicable alternatives exists, do not try other alternatives. The original motivation for this change was to reduce the number of searches for implicit views we do since some overloaded methods like `Int#+` are used a lot, but it turns out that this also makes more code compile (see `overload_directly_applicable.scala` for an example), this change does not seem to match what the specification says (it does not define a notion of "directly applicable") but it does match the behavior of scalac, and it seems useful in general.
* Don't compute implicit scopes for synthetic Lambda traitsGuillaume Martres2016-05-311-1/+4
|
* Avoid creating AndTypes with AnyGuillaume Martres2016-05-311-1/+1
| | | | This reduces the number of implicit scopes we cache.
* OfTypeImplicits: compute refs lazilyGuillaume Martres2016-05-311-1/+1
| | | | | | Many intermediate `OfTypeImplicits` are created during a call to `implicitScope`, but they won't all be used so there is no need to compute `OfTypeImplicits#refs` unless it's actually used.
* Do not miss implicits in type parameters of parentsGuillaume Martres2016-05-311-1/+1
| | | | | This did not work before because we incorrectly looked for their value in the prefix of the type instead of the type itself.
* Fix implicit scope caching bugGuillaume Martres2016-05-311-5/+6
| | | | | | | | | | | | | | The issue is subtle: the `tp` in scope in `def ofTypeImplicits` is the `tp` passed to the top-level `implicitScope` method, not the `tp` passed to the recursively called `iscope`, this means that before this commit, all intermediate `OfTypeImplicit` scopes cached while computing an implicit scope had their `tp` field incorrectly set, which means that we could miss implicits in later implicit searches. Note that the `implicit_cache.scala` test worked before this commit because of the restrictions on caching that exist since b8b0f381ef2cbcb7bad66fd3e7a9ae929baa45f6, it is included anyway because our caching strategy might change in the future.
* Document why we cannot cache all implicit scopesGuillaume Martres2016-05-311-1/+12
|
* Fix `A*` propagating outside matchesFelix Mulder2016-05-271-2/+7
|
* Annotate repeated params with `case` flag to indicate that they are legalFelix Mulder2016-05-272-2/+2
| | | | | | | One drawback with this approach is that the type seems to propagate. I.e. if the return type of an expression is `repeated` then the enclosing variable will get the `repeated` type instead of getting the expected `Seq` type
* Change typer to infer repeated param instead of Seq in `_*` casesFelix Mulder2016-05-271-1/+2
|
* Merge pull request #1270 from dotty-staging/fix-bootstrapDmitry Petrashko2016-05-271-1/+9
|\ | | | | Fix bootstrap
| * Replace aliases to Unit by UnitMartin Odersky2016-05-231-1/+9
| | | | | | | | | | | | | | Do this in the inferred (result-)type of ValDefs and DefDefs. Without this fix, TreeTraverser#traverseChildren in Trees.scala gets a result type of BoxedUnit (but only when co-compiled from source, not when unpickled).
* | Move eqAny to PredefMartin Odersky2016-05-231-2/+2
| |
* | Add Eq instances of standard types to PredefMartin Odersky2016-05-231-2/+14
| | | | | | | | | | | | | | | | | | To make tests pass, this required a looser specification of `assumedCanEquals`, so that an abstract type T can be compared to arbitrary values, as long as its upper bound can be compared. E.g. T == null T == "abc"
* | Tweak of valid eqAny conditionMartin Odersky2016-05-231-39/+30
| |
* | Make use of implicitNotFound for eqaulity errorsMartin Odersky2016-05-232-4/+3
| | | | | | | | | | Needed a fix in string interpolation for suriviving inserted types that contain `$` characters.
* | Print diagnostics to implicits printerMartin Odersky2016-05-231-2/+2
| |
* | Check equality that with == and != makes senseMartin Odersky2016-05-232-12/+45
| | | | | | | | | | | | This is done by checking each instance of an eqAny implicit so that it does not contain non-bottom instances of equality types as instances.
* | Hooks to check that comparisons with == / != make senseMartin Odersky2016-05-233-46/+86
| | | | | | | | | | | | | | | | | | | | Also, check that pattern matching against idents/selects/literals makes sense. The hooks perform an implicit search for an instance of `Eq[L, R]`, where `L`, `R` are the argument types. So far this always succeeeds because Eq.eqAny matches all such types. A separate commit will check the returned search term for validity.
* | Fixed error in commentMartin Odersky2016-05-231-2/+2
| |
* | Downwards comparisons for implicit search and overloading resolutionMartin Odersky2016-05-232-3/+56
| | | | | | | | | | | | | | | | | | Compare selected contravariant arguments as if they were covariant. Which ones is explained in the doc comment for method `isAsSpecificValueType` in Applications.scala. This has the same motivation than what @paulp proposed around 2012. The solution is a bit different from the one proposed then because it only affects top-level parameters.
* | Fix caching problem when computing implicit scopesMartin Odersky2016-05-231-1/+1
| | | | | | | | | | | | Caches were set when information was not complete yet. Problem was exhibited by missing some `eqName` implicits when adding safe equality for Name.
* | Allow auto-tupling for arguments to overloaded methodsMartin Odersky2016-05-231-6/+20
| | | | | | | | | | | | | | | | If all overloaded variants of a method are uniary, we should also allow auto-tupling. This is necessary to make overloaded `==' methods work in cases like: xs == (1, 2)
* | Merge pull request #1249 from dotty-staging/change-early-annotsodersky2016-05-231-2/+3
|\ \ | |/ |/| Evaluate annotations before completing tree of definitions
| * Add class annotations as first step of completing the class.Martin Odersky2016-05-131-1/+2
| |
| * Evaluate annotations before completing tree of definitionsMartin Odersky2016-05-101-1/+1
| | | | | | | | | | | | | | Motive: That way we can identify annotation macros without special name resolution rules. This was surprisingly easy.
* | Handle MergeErrors in RefChecksMartin Odersky2016-05-191-1/+5
| | | | | | | | | | Used to throw an uncaught merge error in checkAllOverrides when compiling i1240c.scala.
* | Revert: ResolveOverloaded should handle alternatives that are the same TermRefMartin Odersky2016-05-181-10/+6
| | | | | | | | | | | | | | This happens once we do not merge methods with the same signature coming from the same class. (reverted from commit 83262d090a98e2374c9b3e5a1480892397d695d3) This case no longer applies as such a situation will now give a MergeError instead.
* | ResolveOverloaded should handle alternatives that are the same TermRefMartin Odersky2016-05-181-6/+10
|/ | | | | This happens once we do not merge methods with the same signature coming from the same class.
* Refine todo commentMartin Odersky2016-04-291-1/+3
|
* Allow dependent method type for unapply.Martin Odersky2016-04-271-3/+2
|
* Revert: Better error diagnostics for "not an extractor" errors.Martin Odersky2016-04-271-17/+2
| | | | | No longer needed because we are going to allow dependent method types in extractors, and the unary requirement is kind of obvious.
* Better error diagnostics for "not an extractor" errors.Martin Odersky2016-04-271-2/+17
| | | | | Now explains in detail why an possibly found unapply or unapplySeq is ineligible.
* Rename Reporting#println -> Reporting#echoMartin Odersky2016-04-271-1/+1
| | | | | | | | | | There's a trap otherwise that, when in a class inheriting from Context (and with it Reporting) a call to println will go to this.println and therefore might not print at all, if the current context buffers messages. I lost a lot of time on this on several occasions when I scratched my head why a simple debug println would not show. Better avoid this in the future for myself and others.
* Comment out debug printlnMartin Odersky2016-04-221-1/+1
|
* Support implicitNotFound annotationMartin Odersky2016-04-222-1/+22
|
* Avoid propagating unresolved implicitsMartin Odersky2016-04-211-1/+1
| | | | | | | | | | When an implicit argument is not found, we should in any case assume the result type of the implicit method as the type of the tree (after reporting an error, of course). If we don't do that, we get implicit errors on weird positions when we try to find an implicit argument for the same tree again. This caused a spurious error in subtyping.scala, and also caused an additional error at the end of EqualityStrawman1.scala.
* Always minimize type variables when interpolating an expected type of an ↵Martin Odersky2016-04-211-6/+7
| | | | | | implicit. This was suggested in #878.
* Address review comments of #1188Dmitry Petrashko2016-04-181-1/+3
|
* Separate handling of genericArray creation from normal ones.Dmitry Petrashko2016-04-182-7/+13
| | | | | | This allowed to simplify the code in both Applications and tpd.newArray. Now, only creation of generic arrays is handled by typer. All other arrays are handled in ArrayConstructors phase.
* Bring back convertNewArray into typer.Dmitry Petrashko2016-04-182-2/+15
| | | | | It's needed in order to create calls to newGenricArray as it needs to infer the ClassTag.
* Decouple handling array constructors from typer.Dmitry Petrashko2016-04-182-12/+2
| | | | It's done in a separate ArrayConstructors phase now.