aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/core/TypeOps.scala
Commit message (Collapse)AuthorAgeFilesLines
* Alternative fixMartin Odersky2017-04-111-4/+5
| | | | | | The original fix made run/hmap-covariant fail because a type variable representing a dependent result parameter was instantiated. Trying something else now.
* Fix #2152: Instantiate dependent result type parametersMartin Odersky2017-04-111-0/+4
| | | | | | | #2152 shows that dependent result type parameters can end up in the types of terms, so we have to eliminate them. If we don't we get orphan parameters in pickling. Fix method name and comment
* Rename PolyParam --> TypeParamRefMartin Odersky2017-04-061-1/+1
|
* Better type inference in harmonizeUnionGuillaume Martres2017-03-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this commit, the added testcase failed because the type of `inv` was inferred to be `Inv[Any]` instead of `Inv[Int]`. The situation looks like this: def inv(cond: Boolean) = if (cond) new Inv(1) // : Inv[A] where A >: Int else Inv.empty // : Inv[A'] where A' unconstrained // : Inv[A] | Inv[A'] To get the type of `inv`, we call `harmonizeUnion` which will take the lub of `Inv[A]` and `Inv[A']`, eventually this mean that we do: A' <:< A But since `harmonizeUnion` uses `fluidly`, this does not result in `A'` getting constrained to be a subtype of `A`, instead we constrain `A` to the upper bound of `A'`: Any <:< A We use `fluidly` to avoid creating OrTypes in `lub`, but it turns out that there is a less aggressive solution: `lub` calls `mergeIfSuper` which then calls `isSubTypeWhenFrozen`, if we just make these subtype calls non-frozen, we can achieve what we want. This is what the new `lub` parameter `canConstrain` allows.
* Drop named type parameters in classesMartin Odersky2017-03-041-10/+4
| | | | | | | | | | | | | 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.
* TempClassInfo#addSuspension: do not capture ContextGuillaume Martres2017-02-201-2/+2
| | | | | | This capture did not cause any problem since we always called TempClassInfo#finalize with the same Context than we captured in `addSuspension`, but it's better to be explicit about these things.
* Merge pull request #1826 from dotty-staging/fix-compile-stdlibGuillaume Martres2016-12-211-1/+1
|\ | | | | Make more parts of stdlib compile
| * Make `msg` in testScala2Mode by-name.Martin Odersky2016-12-201-1/+1
| | | | | | | | Avoids potentially expensive string assembly operations.
* | Address reviewer's commentsMartin Odersky2016-12-211-2/+2
| |
* | Fix #1795: Avoid infinite recursion between member and asSeenFromMartin Odersky2016-12-211-4/+16
|/
* Make errors are not swept under the carpetMartin Odersky2016-12-171-1/+1
| | | | | | | | | Typer#ensureReported's comment outlines an example where errors could go unreported, resulting in error trees after typer without any reported error messages. This commit makes sure that at least one error is reported if a tree node has an error type. Fixes #1802.
* Fix #1751: Make dominator work after erasureMartin Odersky2016-12-021-0/+3
| | | | | | i1751.scala shows a case where we need to compute the approximation of an or-type during erasure. This can lead to an empty set of common classes because Any does not exist anymore after erasure.
* Move compiler and compiler tests to compiler dirFelix Mulder2016-11-221-0/+554