aboutsummaryrefslogtreecommitdiff
path: root/tests/pos
Commit message (Collapse)AuthorAgeFilesLines
* Move varargs tests to top-level pos and negFelix Mulder2017-03-292-0/+0
|
* Fix i851.java not being valid javaFelix Mulder2017-03-291-1/+1
|
* Fix varargs in methods and constructors (#2135)Igor Mielientiev2017-03-222-0/+6
| | | | | | | * Fix varargs in methods (Issue: #1625) * Fix minor comments * Change varargs parameter message * Fix failed test, fix case for constructor
* Better type inference in harmonizeUnionGuillaume Martres2017-03-181-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Reduce type lambdas even if variance changesGuillaume Martres2017-03-161-0/+3
| | | | | | | | | | | | | | | Previously, the added testcase failed with (when running with -Ydebug-alias): 2 | def foo = Seq(a) | ^ |covariant type A occurs in invariant position in type => Seq.CC[Cov.this.A] of method foo Because the type parameter of `CC` is invariant. Of course, this is fine because `CC[A]` can be reduced to `Seq[A]`, but before this commit, `TypeApplications#appliedTo` used to disallow reductions that replaced an invariant type parameter with a variant one. I believe that for type inference, only preserving the arity is important, so I removed this restriction.
* Merge pull request #2096 from dotty-staging/fix-i2051Dmitry Petrashko2017-03-151-0/+9
|\ | | | | Fix #2051: allow override T with => T or ()T
| * add more testsliu fengyun2017-03-141-0/+7
| |
| * fix #2051: allow override T with => T or ()Tliu fengyun2017-03-141-0/+2
| |
* | Test casesMartin Odersky2017-03-141-0/+15
| |
* | fix #2071: handle HKApply in SAMTypeliu fengyun2017-03-141-0/+7
|/
* Merge pull request #2080 from dotty-staging/fix#-2066odersky2017-03-121-0/+15
|\ | | | | Fix #2066: Don't qualify private members in SelectionProto's...
| * Fix #2066: Don't qualify private members in SelectionProto's...Martin Odersky2017-03-121-0/+15
| | | | | | | | ... unless they would be accessible in the given context.
* | Add original test case of #360Martin Odersky2017-03-121-0/+6
| |
* | Fix #1569: Improve avoidance algorithmMartin Odersky2017-03-121-0/+6
|/ | | | | | The essential change is that we do not throw away more precise info of the avoided type if the expected type is fully defined.
* Merge pull request #2070 from dotty-staging/fix/erasedLubodersky2017-03-091-0/+15
|\ | | | | Fix bug in erasedLub leading to incorrect signatures
| * Fix bug in erasedLub leading to incorrect signaturesGuillaume Martres2017-03-081-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+15
|\ \ | | | | | | Fix #2064: Avoid illegal types in OrDominator
| * | Fix #2064: Avoid illegal types in OrDominatorMartin Odersky2017-03-081-0/+15
| | | | | | | | | | | | | | | 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-093-0/+76
|\ \ \ | | | | | | | | Fix type inference for HLists and HMaps
| * | | More testsMartin Odersky2017-03-022-0/+42
| | | | | | | | | | | | | | | | and a typo fixed
| * | | Move depmeth tests back to pendingMartin Odersky2017-03-012-149/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I believe this worked only accidentally because we matched more things with wildcards which turned out to be flawed. The test errors show some funky _#_ types, so not sure whether the tests are still valid or not. Moved back to pending awaiting further resolution.
| * | | Re-instantiate depmeth testsMartin Odersky2017-02-283-0/+183
| | | | | | | | | | | | | | | | | | | | These now compile with the changes to dependent methods, except for one which is invalid under dotty.
* | | | Drop special case around Function1Martin Odersky2017-03-083-91/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | Disallow subtypes of Function1 acting as implicit conversionsMartin Odersky2017-03-081-0/+3
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Disable most tests that depend on scala-reflectGuillaume Martres2017-03-083-46/+0
| |/ |/|
* | Fix #2056: Backend crash when inlined method contains tryGuillaume Martres2017-03-071-0/+13
|/ | | | | | 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 #2015 from dotty-staging/add-pf-overloadingodersky2017-02-231-0/+41
|\ | | | | Add overloading support for case-closures
| * Extend argument pretyping to case-closuresMartin Odersky2017-02-211-5/+5
| |
| * Add overloading support for case-closuresMartin Odersky2017-02-211-0/+41
| | | | | | | | | | | | case-closures (which are represented as Match nodes) have a known arity just like other function literals. So shape analysis for overloading resolution should apply to them as well.
* | Fix #2009: Fix placeholder params logic for lambdas (#2019)odersky2017-02-221-0/+9
|/ | | | | | | | | | * Fix #2009: Fix placeholder params logic for lambdas Logic was missing placeholders in rhs of lambdas. * Add comment * Fix typo
* Merge pull request #1996 from dotty-staging/fix-#1990odersky2017-02-212-0/+32
|\ | | | | Fix #1990: Handle inlining where this proxies change types
| * Fix sorting of accessed this-proxiesMartin Odersky2017-02-191-0/+20
| | | | | | | | | | | | | | They are sorted according to the nesting depth of the classes they represent. This is no necessarily the same as the nesting level of the symbols of the proxy classes. i1990a.scala shows an example where the two differ.
| * Fix #1990: Handle case where inlining changes class of outerMartin Odersky2017-02-181-0/+12
| | | | | | | | | | | | | | | | | | | | The new situation in the test was that outer of the inlined method was `A` but it's as seen from type is a subtype `B`. We need two fixes: - Ignore outerSelects in TreeChecker. These are treated as having fixed symbols. - Adapt the outer-path logic to deal with code that's moved to another context.
* | Disable tests that require scala-compilerGuillaume Martres2017-02-185-206/+0
|/ | | | This is necessary if we ever want to get rid of our dependency on scala-compiler
* Fix #1976: Hack to support scala.xml's $scope (#1977)odersky2017-02-141-0/+4
| | | | | | This is a gross hack to support the need for a $scope binding when XML literals are created. It should go away once we phase out XML literals. A library-based solution should use implicits instead.
* Fix #1975: Align valdefs and for expressions for patternsMartin Odersky2017-02-141-0/+5
| | | | | | | | val definitions and for expressions both distinguish whether something is a pattern or a variable binding. They no do it the same way: `ident` or an `ident: type` is a variable binding, everything else is a pattern. Previously, capitalized idents were considered as bindings in valdefs but as pattern in fors.
* Fix parsing annotation on function typeGuillaume Martres2017-02-121-0/+1
|
* Merge pull request #1921 from dotty-staging/fix-#1907odersky2017-02-082-3/+3
|\ | | | | Fix #1907: Improve error message
| * Disallow taking a class tag of Nothing or Null.Martin Odersky2017-02-012-3/+3
| | | | | | | | | | | | | | | | 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.
* | Merge pull request #1941 from dotty-staging/fix/infix-posodersky2017-02-081-0/+4
|\ \ | | | | | | Better positions for infix operations
| * | Represent untyped operators as Ident instead of NameGuillaume Martres2017-02-051-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | This has two advantages: - We can distinguish BackquotedIdent from Ident, allowing the user to use a defined "type `&`", see testcase. - We get better positions for the operators. This is useful in IDEs, for example to get the type at point.
* | | Fix wildApprox functionMartin Odersky2017-02-071-0/+1
|/ / | | | | | | | | | | | | | | | | | | 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.
* | Merge pull request #1922 from dotty-staging/fix-#1723odersky2017-02-021-0/+8
|\ \ | | | | | | Fix-#1723: Avoid private leaks on completion
| * | Fix-#1723: Avoid private leaks on completionMartin Odersky2017-02-011-0/+8
| |/ | | | | | | As #1723 demonstrates, doing this at PostTyper is too late.
* | Merge pull request #1881 from dotty-staging/add-structural-selectodersky2017-02-012-0/+50
|\ \ | | | | | | Implement structural type member access
| * | Add test case for #1866Martin Odersky2017-01-101-0/+5
| | | | | | | | | | | | The PR also fixes #1866, as shown by this test case.
| * | Change scheme to use SelectableMartin Odersky2017-01-071-0/+1
| | | | | | | | | | | | | | | Use base types instead of implicits. This is more robust in the presence of type abstraction.
| * | Implement structural type member accessMartin Odersky2017-01-051-0/+44
| | | | | | | | | | | | New scheme for implementing structural type member access.
* | | Fix #1916 - fix erasure of xxl closuresMartin Odersky2017-01-311-72/+0
| |/ |/| | | | | | | xxl closures need to get the SAM type FunctionXXL as their explicit type field after ersure.
* | Test that #1687 is fixed.Dmitry Petrashko2017-01-222-0/+29
| | | | | | | | The b-test would compile for a millenia without the fix.