diff options
author | Antonio Cunei <antonio.cunei@epfl.ch> | 2010-09-01 17:55:07 +0000 |
---|---|---|
committer | Antonio Cunei <antonio.cunei@epfl.ch> | 2010-09-01 17:55:07 +0000 |
commit | 512a7a03e0c0a964f067483930f430b05eae744d (patch) | |
tree | a0b3527934ed1f5ae1f051573541419f85595dcd /test | |
parent | 7f1e23872efb20a1cebe765ee319e628582dd517 (diff) | |
download | scala-512a7a03e0c0a964f067483930f430b05eae744d.tar.gz scala-512a7a03e0c0a964f067483930f430b05eae744d.tar.bz2 scala-512a7a03e0c0a964f067483930f430b05eae744d.zip |
Merged revisions 22508-22520,22523,22545,22710,...
Merged revisions
22508-22520,22523,22545,22710,22726-22727,22754-22755,22762,22796,22804-
22805 via svnmerge from
https://lampsvn.epfl.ch/svn-repos/scala/scala/trunk
........
r22508 | moors | 2010-07-08 17:58:41 +0200 (Thu, 08 Jul 2010) | 7 lines
closes #2331: the pre-transform in Erasure did not correctly recurse
in the case of a TypeApply.
It simply returned the function, which might very well have been, say,
a Select node, which had to be erased in case the qualifier's type is a
refinement.
(sorry about the whitespace changes)
review by odersky
........
r22509 | moors | 2010-07-08 17:58:47 +0200 (Thu, 08 Jul 2010) | 7 lines
closes #2416. this is a big one... typedAppliedTypeTree performed type
application (beta-reduction) without checking whether that application
was well-kinded
this patch introduces a new subclass of TypeTree: TypeTreeWithDeferredRefCheck, which tracks the type args and type params of a type application when it was beta-reduced during typing without checking that the application was well-kinded -- that check must wait until refchecks, but was never performed since the application had been beta-reduced away
caveat discovered while working on the fix: adapt turned all trees for
which _.isType holds into TypeTree's
review by odersky
........
r22510 | moors | 2010-07-08 17:58:52 +0200 (Thu, 08 Jul 2010) | 2 lines
closes #3247: syntax error regarding context bounds generalized to
include view bounds as we cannot easily be more specific no review
........ r22511 | moors | 2010-07-08 17:58:56 +0200 (Thu, 08 Jul 2010) |
2 lines
closes #3249. exclude method type parameters from java generic
signature of a class review by dragos ........ r22512 | moors |
2010-07-08 17:59:00 +0200 (Thu, 08 Jul 2010) | 2 lines
closes #3374. checkKindBoundsHK did not instantiate hk params far
enough. see also neg/bug1275 review by odersky ........ r22513 | moors |
2010-07-08 17:59:05 +0200 (Thu, 08 Jul 2010) | 5 lines
closes #3399. mergePrefixAndArgs expects types that have equal type
symbols (modulo normalization) but did not normalize these types before
retrieving their typeArgs
this broke the invariant that argss is a regular matrix
review by odersky
........
r22514 | moors | 2010-07-08 17:59:10 +0200 (Thu, 08 Jul 2010) | 15 lines
closes #3477. type arguments that were inferred to be Nothing should
be included in checkBounds. wonder why they weren't in the first place
note that all type parameters must be reported in error messages about
failing type inference, but only type parameters that were inferred
successfully should be substituted
the idea of mapping type parameter symbols to the corresponding type
ref in order to make substitution the identity does not seem to work,
leading to errors like:
src/library/scala/collection/immutable/SortedMap.scala:38:
error: type mismatch; found :
scala.collection.immutable.SortedMap[A,B(in method empty)]
required: scala.collection.immutable.SortedMap[A,B(in trait
SortedMap)]
override def empty: SortedMap[A, B] = SortedMap.empty
^
(I guess that's why they were retracted before, but that wasn't done consistently, leading to #3152 -- my first attempt at fixing the latter lead to this bug... I've assigned #3152 to you Martin, as I can't decide how to fix it.)
review by odersky
........
r22515 | moors | 2010-07-08 17:59:15 +0200 (Thu, 08 Jul 2010) | 5 lines
closes #3486. members of implclasses are clones of the original trait
members, but cloning discards a symbol's typehistory so that javaSig
could not look at the symbol's type before erasure
fixed by having mixin do the cloning at the beginning of erasure and
then updating the symbol's info to transform it to be valid in current
phase
review by odersky
........
r22516 | moors | 2010-07-08 17:59:19 +0200 (Thu, 08 Jul 2010) | 3 lines
closes #3494. don't let type argument for inserted wrapRefArray be
inferred (as the expected element type of the array could be a singleton
type, but that won't be inferred)
review by prokopec
........
r22517 | moors | 2010-07-08 17:59:23 +0200 (Thu, 08 Jul 2010) | 1 line
closes #3507: don't generate manifests where we can't refer to the
existentially bound value ........ r22518 | moors | 2010-07-08 17:59:27
+0200 (Thu, 08 Jul 2010) | 3 lines
closes #742. be more resilient to evil, ill-kinded type applications,
so we don't crash (subst assumes from.length == to.length), and get to
actually telling off the user for writing those nasty, nasty types
review by extempore
........
r22519 | moors | 2010-07-08 17:59:32 +0200 (Thu, 08 Jul 2010) | 2 lines
closes #3622: refchecks erased types without uncurrying them first
review by odersky ........ r22520 | moors | 2010-07-08 17:59:36 +0200
(Thu, 08 Jul 2010) | 1 line
made typechecker logging methods final so they can actually be inlined
........ r22523 | moors | 2010-07-09 02:24:02 +0200 (Fri, 09 Jul 2010) |
3 lines
cleaned up the mess that resulted from cobbling together fixes for
see #3477 and see #3152 adjustTypeArgs and methTypeArgs now return a
LinkedHashMap[Symbol, Option[Type]] TODO: check that type inference
is still just as lightning fast as before ........ r22545 | moors |
2010-07-12 19:03:03 +0200 (Mon, 12 Jul 2010) | 7 lines
Closes #3653. In uncurry phase, remove IMPLICIT flag from implicit
parameter list. no review
Author: Mark Harrah <dmharrah@gmail.com>
Date: Thu Jul 8 10:30:57 2010 -0400
Source: http://github.com/harrah/scala-starrless/commit/0c7759c95b47cebc6d9fa77cefd34ef638e2706e
Reviewer: moors
........
r22710 | moors | 2010-08-09 13:51:37 +0200 (Mon, 09 Aug 2010) | 10 lines
closes #3582: typedTypeDef needs to run in a new typer for TypeDefs
with type parameters
this was honored when typedTypeDef was called by typed1, but other
callers did not this would cause higher-order type parameters to be
re-entered in the scope of a method or a class
(by the way, should we recycle scopes for higher-order type params?
now new scopes are created, symbols entered, and tree's symbols updated)
changed some spurious vars to vals
review by odersky
........
r22726 | moors | 2010-08-10 23:06:00 +0200 (Tue, 10 Aug 2010) | 5 lines
closes #3676: cycle detection logic in BaseTypeSeq's should not
overwrite elements in the BTS for cycle detection as these markers may
be witnessed by callbacks in mergePrefixAndArgs
now using a mutable bitset to keep track of which computations are pending -- benchmarked for speed, memory consumption not checked
review by odersky
........
r22727 | moors | 2010-08-10 23:12:13 +0200 (Tue, 10 Aug 2010) | 5 lines
different approach to manifests of type parameters: before, ambiguity was prevented by leaving type inference failures (Nothing was inferred) in the expression that needs an implicit manifest -- we now put these back in undetparams (maybe they will be inferred) and when we need to produce a manifest for an undetermined parameter (it ended up not being inferred), we assume it will get instantiated to Nothing (but for now don't actually reflect that in the SearchResult, as instantiate should take care of that anyway)
see test file for use case that works with this new scheme, but did not work before: the eager instantiation of type params to Nothing before implicit search even got started would indeed prevent ambiguity -- unfortunately it also ruled out valid code like this (where the type parameter is inferred successfully by the time the manifest is needed)
review by odersky
........
r22754 | moors | 2010-08-13 18:21:40 +0200 (Fri, 13 Aug 2010) | 10 lines
closes #3419: test files
omit check that wouldn't work with separate compilation, not needed
anymore because compiler has become more robust
the actual fix was committed as part of r22512, see #3374
also see #3512
no review
........
r22755 | moors | 2010-08-13 18:21:44 +0200 (Fri, 13 Aug 2010) | 8 lines
closes #3663. disregard package nesting for access check of java syms
namers wasn't setting privateWithin on java-defined variables (btw, )
shouldn't clone carry over privateWithin? better treatment of linked )
class access boundary (only check for access within linked class if )
it actually exists )
would have liked more control for the test case: only javac should
compile the java file, then scalac should compile the scala file and
fail
review by odersky
........
r22762 | moors | 2010-08-14 10:19:56 +0200 (Sat, 14 Aug 2010) | 5 lines
closes #3691. moved kind conformance checks to types because it needs
to be checked as part of specializesSym.
TODO: clean this up, introduce datatypes to denote kinds, split
checkKindBounds into kind inference and subkind checking
review by odersky
........
r22796 | moors | 2010-08-19 14:20:28 +0200 (Thu, 19 Aug 2010) | 3 lines
closes #3777. type constructor inference now tries harder to unify a
type constructor variable (that's applied to type arguments) with a type
alias by dealiasing it, hoping to discover a concrete type constructor
(that's applied to type arguments).
no review
........
r22804 | moors | 2010-08-20 16:48:12 +0200 (Fri, 20 Aug 2010) | 12 lines
closes 2462. better implicit error messages.
@implicitNotFound(msg="Custom error message that may refer to type parameters ${T} and ${U}")
trait Constraint[T, U]
whenever an implicit argument of type Constraint[A, B] cannot be
found, the custom error message will be used, where the type arguments
are interpolated in the obvious way
note: if the msg in the annotation references non-existing type
params, a warning is emitted
the patch also cleans up annotation argument retrieval (moved it to
AnnotationInfo from Symbol)
review by odersky
........
r22805 | moors | 2010-08-21 10:25:00 +0200 (Sat, 21 Aug 2010) | 1 line
forgot to update check file after renaming tests. no review. ........
Diffstat (limited to 'test')
40 files changed, 319 insertions, 18 deletions
diff --git a/test/files/neg/bug1275.check b/test/files/neg/bug1275.check index 9f806c0689..6ee8365796 100644 --- a/test/files/neg/bug1275.check +++ b/test/files/neg/bug1275.check @@ -1,4 +1,6 @@ -bug1275.scala:13: error: The kind of type MyType does not conform to the expected kind of type MyType[+t] <: TestCovariance.Seq[t] in trait Seq. - def span[a, s <: Seq[a] { type MyType <: s } ](xs: s): s = xs f - ^ +bug1275.scala:11: error: type mismatch; + found : xs.MyType[a] + required: s + = xs f + ^ one error found diff --git a/test/files/neg/bug1275.scala b/test/files/neg/bug1275.scala index e9be13c763..1175b30763 100644 --- a/test/files/neg/bug1275.scala +++ b/test/files/neg/bug1275.scala @@ -1,14 +1,15 @@ -// tested using Scala compiler version 2.6.0-RC1 -- (c) 2002-2010 LAMP/EPFL - -// prompted by "Covariant return types" mailing list question -object TestCovariance { - - // see Type constructor polymorphism in http://www.scala-lang.org/docu/changelog.html - trait Seq[+t] { - type MyType[+t] <: Seq[t] - - def f: MyType[t] - } - - def span[a, s <: Seq[a] { type MyType <: s } ](xs: s): s = xs f -} +object Test { + trait Seq[+t] { + type MyType[+t] <: Seq[t] + + def f: MyType[t] + } + + // illegal abstract type member refinement: changes the arity of MyType + // the error is pretty strange, since the compiler forms the illegal type xs.MyType[a] anyway + def span[a, s <: Seq[a] { type MyType/*look ma, no type parameters!*/ <: s } ](xs: s): s + = xs f +// ^ +// found : xs.MyType[a] +// required: s +}
\ No newline at end of file diff --git a/test/files/neg/bug882.check b/test/files/neg/bug882.check index 8f47fefd9b..4e3e6d0860 100644 --- a/test/files/neg/bug882.check +++ b/test/files/neg/bug882.check @@ -1,4 +1,4 @@ -bug882.scala:2: error: traits cannot have type parameters with context bounds `: ...' +bug882.scala:2: error: traits cannot have type parameters with context bounds `: ...' nor view bounds `<% ...' trait SortedSet[A <% Ordered[A]] { ^ one error found diff --git a/test/files/neg/t2416.check b/test/files/neg/t2416.check new file mode 100644 index 0000000000..0899ad09d5 --- /dev/null +++ b/test/files/neg/t2416.check @@ -0,0 +1,10 @@ +t2416.scala:3: error: type arguments [Int] do not conform to trait A's type parameter bounds [X <: Double] + def x : A[Int]#B = 10 // no you won't + ^ +t2416.scala:8: error: type arguments [Boolean] do not conform to type B's type parameter bounds [Y <: Double] + def x : A#B[Boolean] = 10 // seriously? + ^ +t2416.scala:13: error: type arguments [String] do not conform to type B's type parameter bounds [Z <: Double] + type C[Z <: A] = Z#B[String] // nuh-uh! + ^ +three errors found diff --git a/test/files/neg/t2416.scala b/test/files/neg/t2416.scala new file mode 100644 index 0000000000..6bb57a984b --- /dev/null +++ b/test/files/neg/t2416.scala @@ -0,0 +1,14 @@ +object t2416a { + trait A[X <: Double] { type B = X } + def x : A[Int]#B = 10 // no you won't +} + +object t2416b { + trait A{type B[Y <: Double] = Int} + def x : A#B[Boolean] = 10 // seriously? +} + +object t2416c { + trait A{type B[Z <: Double] = Int} + type C[Z <: A] = Z#B[String] // nuh-uh! +}
\ No newline at end of file diff --git a/test/files/neg/t2462a.check b/test/files/neg/t2462a.check new file mode 100644 index 0000000000..040a01f3a1 --- /dev/null +++ b/test/files/neg/t2462a.check @@ -0,0 +1,4 @@ +t2462a.scala:2: error: Cannot construct a collection of type List[String] with elements of type Int based on a collection of type List[String]. + List(1,2,3).map[Int, List[String]](x => 1) + ^ +one error found diff --git a/test/files/neg/t2462a.scala b/test/files/neg/t2462a.scala new file mode 100644 index 0000000000..2d523b4dd8 --- /dev/null +++ b/test/files/neg/t2462a.scala @@ -0,0 +1,3 @@ +object Test { + List(1,2,3).map[Int, List[String]](x => 1) +}
\ No newline at end of file diff --git a/test/files/neg/t2462b.check b/test/files/neg/t2462b.check new file mode 100644 index 0000000000..bc0d9aa469 --- /dev/null +++ b/test/files/neg/t2462b.check @@ -0,0 +1,14 @@ +t2462b.scala:6: warning: Invalid implicitNotFound message for trait Meh in package test: +The type parameters Too, Elem referenced in the message of the @implicitNotFound annotation are not defined by trait Meh. +trait Meh[-From, +To] + ^ +t2462b.scala:9: warning: Invalid implicitNotFound message for trait Meh2 in package test: +The type parameter Elem referenced in the message of the @implicitNotFound annotation is not defined by trait Meh2. +trait Meh2[-From, +To] + ^ +t2462b.scala:12: error: overriding method x in class thankyoupartest of type => Int; + method x needs `override' modifier +class testmustfail extends thankyoupartest { def x = 43 } + ^ +two warnings found +one error found diff --git a/test/files/neg/t2462b.scala b/test/files/neg/t2462b.scala new file mode 100644 index 0000000000..7a1389cc8e --- /dev/null +++ b/test/files/neg/t2462b.scala @@ -0,0 +1,12 @@ +package test + +import scala.annotation.implicitNotFound + +@implicitNotFound(msg = "Cannot construct a collection of type ${Too} with elements of type ${Elem} based on a collection of type ${From}.") +trait Meh[-From, +To] + +@implicitNotFound(msg = "Cannot construct a collection of type ${To} ${Elem}.") +trait Meh2[-From, +To] + +class thankyoupartest { def x = 42 } +class testmustfail extends thankyoupartest { def x = 43 } diff --git a/test/files/neg/t3399.check b/test/files/neg/t3399.check new file mode 100644 index 0000000000..eb6c679704 --- /dev/null +++ b/test/files/neg/t3399.check @@ -0,0 +1,4 @@ +t3399.scala:23: error: could not find implicit value for parameter e: =:=[Nats.Add[Nats._1,Nats._1],Nats._1] + implicitly[ Add[_1, _1] =:= _1] + ^ +one error found diff --git a/test/files/neg/t3399.scala b/test/files/neg/t3399.scala new file mode 100644 index 0000000000..3edaa0724f --- /dev/null +++ b/test/files/neg/t3399.scala @@ -0,0 +1,24 @@ +object Nats { + sealed trait Nat { + // fold right on N, N-1, ..., 1 + type FoldR[Init <: Type, Type, F <: Fold[Nat, Type]] <: Type + } + sealed trait _0 extends Nat { + type FoldR[Init <: Type, Type, F <: Fold[Nat, Type]] = Init + } + sealed trait Succ[N <: Nat] extends Nat { + type FoldR[Init <: Type, Type, F <: Fold[Nat, Type]] = + F#Apply[Succ[N], N#FoldR[Init, Type, F]] + } + + type Add[A <: Nat, B <: Nat] = A#FoldR[B, Nat, Inc] + trait Fold[-Elem, Value] { + type Apply[N <: Elem, Acc <: Value] <: Value + } + type Inc = Fold[Any, Nat] { + type Apply[N <: Any, Acc <: Nat] = Succ[Acc] + } + + type _1 = Succ[_0] + implicitly[ Add[_1, _1] =:= _1] +}
\ No newline at end of file diff --git a/test/files/neg/t3507.check b/test/files/neg/t3507.check new file mode 100644 index 0000000000..1246a20d09 --- /dev/null +++ b/test/files/neg/t3507.check @@ -0,0 +1,4 @@ +t3507.scala:13: error: could not find implicit value for evidence parameter of type Manifest[object _1.b.c] + mani/*[object _1.b.c]*/(c) // kaboom in manifestOfType / TreeGen.mkAttributedQualifier + ^ +one error found diff --git a/test/files/neg/t3507.scala b/test/files/neg/t3507.scala new file mode 100644 index 0000000000..9a8c7c5462 --- /dev/null +++ b/test/files/neg/t3507.scala @@ -0,0 +1,15 @@ +class A { + object b { + object c + } + def m = b.c +} + +object Test { + var a: A = new A // mutable + val c /*: object _1.b.c forSome { val _1: A } */ = a.m // widening using existential + + def mani[T: Manifest](x: T) = () + mani/*[object _1.b.c]*/(c) // kaboom in manifestOfType / TreeGen.mkAttributedQualifier + // --> _1 is not in scope here +}
\ No newline at end of file diff --git a/test/files/neg/t3653.check b/test/files/neg/t3653.check new file mode 100644 index 0000000000..ac6e2ca9dc --- /dev/null +++ b/test/files/neg/t3653.check @@ -0,0 +1,7 @@ +t3653.scala:3: error: double definition: +method x:(implicit x: Int)Int and +method x:(i: Int)Int at line 2 +have same type after erasure: (x: Int)Int + def x(implicit x: Int) = 5 + ^ +one error found diff --git a/test/files/neg/t3653.scala b/test/files/neg/t3653.scala new file mode 100644 index 0000000000..96cf96008a --- /dev/null +++ b/test/files/neg/t3653.scala @@ -0,0 +1,4 @@ +class B { + def x(i: Int) = 3 + def x(implicit x: Int) = 5 +}
\ No newline at end of file diff --git a/test/files/neg/t3663.check b/test/files/neg/t3663.check new file mode 100644 index 0000000000..09ea25ad91 --- /dev/null +++ b/test/files/neg/t3663.check @@ -0,0 +1,4 @@ +main.scala:11: error: variable foo cannot be accessed in test.Test + println(t.foo) + ^ +one error found diff --git a/test/files/neg/t3663/PackageProtected.java b/test/files/neg/t3663/PackageProtected.java new file mode 100644 index 0000000000..f4535a55b4 --- /dev/null +++ b/test/files/neg/t3663/PackageProtected.java @@ -0,0 +1,5 @@ +package test; + +class PackageProtected { + int foo; +} diff --git a/test/files/neg/t3663/main.scala b/test/files/neg/t3663/main.scala new file mode 100644 index 0000000000..29619550cc --- /dev/null +++ b/test/files/neg/t3663/main.scala @@ -0,0 +1,14 @@ +package test + +final class Test extends PackageProtected { + def bar = foo +} + +package another { + object Main { + def bug(t: Test) { + // Can always be replicated. + println(t.foo) + } + } +}
\ No newline at end of file diff --git a/test/files/neg/t3691.check b/test/files/neg/t3691.check new file mode 100644 index 0000000000..1b548cc84d --- /dev/null +++ b/test/files/neg/t3691.check @@ -0,0 +1,16 @@ +t3691.scala:4: error: type mismatch; + found : java.lang.Object with Test.A[String] + required: AnyRef{type A[x]} + val b = (new A[String]{}): { type A[x] } // not ok + ^ +t3691.scala:5: error: type mismatch; + found : java.lang.Object with Test.A[String] + required: AnyRef{type A} + val c = (new A[String]{}): { type A } // not ok + ^ +t3691.scala:7: error: type mismatch; + found : java.lang.Object{type A = String} + required: AnyRef{type A[X]} + val x = (new { type A = String }): { type A[X] } // not ok + ^ +three errors found diff --git a/test/files/neg/t3691.scala b/test/files/neg/t3691.scala new file mode 100644 index 0000000000..69e8bef630 --- /dev/null +++ b/test/files/neg/t3691.scala @@ -0,0 +1,11 @@ +object Test { + trait A[X] { type A[x <: X] = x } + val a = (new A[String]{}): { type A[x <: String] } // ok + val b = (new A[String]{}): { type A[x] } // not ok + val c = (new A[String]{}): { type A } // not ok + + val x = (new { type A = String }): { type A[X] } // not ok +//a: AnyRef{type A[X]} + + identity[x.A[Any]] _ +}
\ No newline at end of file diff --git a/test/files/neg/t742.check b/test/files/neg/t742.check new file mode 100644 index 0000000000..f587948ef1 --- /dev/null +++ b/test/files/neg/t742.check @@ -0,0 +1,5 @@ +t742.scala:5: error: kinds of the type arguments (Crash._1,Crash._2,Any) do not conform to the expected kinds of the type parameters (type m,type n,type z). +Crash._1's type parameters do not match type m's expected parameters: type s1 has one type parameter, but type n has two + type p = mul[_1, _2, Any] // mul[_1, _1, Any] needs -Yrecursion + ^ +one error found diff --git a/test/files/neg/t742.scala b/test/files/neg/t742.scala new file mode 100644 index 0000000000..bb1c2f85ea --- /dev/null +++ b/test/files/neg/t742.scala @@ -0,0 +1,8 @@ +object Crash { + type mul[m[n[s[_], z], z], n[s[_], z], z] = m[n, z] + type _1[s1[_], z1] = s1[z1] + type _2[s1[_], z1] = s1[z1] + type p = mul[_1, _2, Any] // mul[_1, _1, Any] needs -Yrecursion + // _1[_2, Zero] + // _2[Zero] +}
\ No newline at end of file diff --git a/test/files/pos/nothing_manifest_disambig.scala b/test/files/pos/nothing_manifest_disambig.scala new file mode 100644 index 0000000000..9a3db0c6d4 --- /dev/null +++ b/test/files/pos/nothing_manifest_disambig.scala @@ -0,0 +1,10 @@ +object Test { + def mani[T: Manifest](xs: T) = xs + mani(List()) + + def listElMani[T: Manifest](xs: List[T]) = xs + listElMani(List()) + + def foo[A, C](m : C)(implicit ev: C <:< Traversable[A], mani: Manifest[A]): (C, A, Manifest[A]) = (m, m.head, mani) + foo(List(1,2,3)) +}
\ No newline at end of file diff --git a/test/files/pos/t2331.scala b/test/files/pos/t2331.scala new file mode 100644 index 0000000000..9a15b5c2a9 --- /dev/null +++ b/test/files/pos/t2331.scala @@ -0,0 +1,11 @@ +trait C { + def m[T]: T +} + +object Test { + val o /*: C --> no crash*/ = new C { + def m[T]: Nothing /*: T --> no crash*/ = error("omitted") + } + + o.m[Nothing] +}
\ No newline at end of file diff --git a/test/files/pos/t3249/Test.java b/test/files/pos/t3249/Test.java new file mode 100644 index 0000000000..4cc7cb2ab5 --- /dev/null +++ b/test/files/pos/t3249/Test.java @@ -0,0 +1,5 @@ +public class Test { + public static void meh() { + new A<Integer>().f(); + } +}
\ No newline at end of file diff --git a/test/files/pos/t3249/a.scala b/test/files/pos/t3249/a.scala new file mode 100644 index 0000000000..0394464549 --- /dev/null +++ b/test/files/pos/t3249/a.scala @@ -0,0 +1,11 @@ +class A[U] { def f[T] = { class X extends A[T] } } + + +/* +$ scalac a.scala +$ javac -cp .:$SCALA_HOME/lib/scala-library.jar -Xprint 'A$X$1' + + public class X$1 extends A<java.lang.Object> implements scala.ScalaObject { + public X$1(A<U> null); + } +*/
\ No newline at end of file diff --git a/test/files/pos/t3374.scala b/test/files/pos/t3374.scala new file mode 100644 index 0000000000..4c0293181d --- /dev/null +++ b/test/files/pos/t3374.scala @@ -0,0 +1,6 @@ +trait Parent { + type Test[A, H[B <: A]] +} +trait Sub extends Parent { + type Test[AS, HS[B <: AS]] = AS +}
\ No newline at end of file diff --git a/test/files/pos/t3419/B_1.scala b/test/files/pos/t3419/B_1.scala new file mode 100644 index 0000000000..a8ec7edba4 --- /dev/null +++ b/test/files/pos/t3419/B_1.scala @@ -0,0 +1,3 @@ +trait T[A,B] { + type X[a <: A, b <: B] <: B +}
\ No newline at end of file diff --git a/test/files/pos/t3419/C_2.scala b/test/files/pos/t3419/C_2.scala new file mode 100644 index 0000000000..da721d2c31 --- /dev/null +++ b/test/files/pos/t3419/C_2.scala @@ -0,0 +1,3 @@ +object F { + type S = T[Any,Int] {type X[N <: Int, Acc <: Int] = Acc} +}
\ No newline at end of file diff --git a/test/files/pos/t3477.scala b/test/files/pos/t3477.scala new file mode 100644 index 0000000000..660aa55736 --- /dev/null +++ b/test/files/pos/t3477.scala @@ -0,0 +1,7 @@ +class J3 { + def f[K, K1 >: K, V](x: Map[K1, V]): Map[K, V] = error("") +} + +object Test { + (new J3).f(Map[Int, Int]()) +}
\ No newline at end of file diff --git a/test/files/pos/t3486/JTest.java b/test/files/pos/t3486/JTest.java new file mode 100644 index 0000000000..0bf388b72d --- /dev/null +++ b/test/files/pos/t3486/JTest.java @@ -0,0 +1,3 @@ +public class JTest<A> extends T2<A> { + public A m( A a ) { return a; } +}
\ No newline at end of file diff --git a/test/files/pos/t3486/test.scala b/test/files/pos/t3486/test.scala new file mode 100644 index 0000000000..544232b0d1 --- /dev/null +++ b/test/files/pos/t3486/test.scala @@ -0,0 +1,6 @@ +trait Test[A] { + def m( a: A ): A + def specified(a:A):A = a +} + +abstract class T2[A] extends Test[A]
\ No newline at end of file diff --git a/test/files/pos/t3494.scala b/test/files/pos/t3494.scala new file mode 100644 index 0000000000..35a4bcde5d --- /dev/null +++ b/test/files/pos/t3494.scala @@ -0,0 +1,7 @@ +object Test { + def f[T](xs: T*) = () + + val x = "abc" + + f[x.type](x) +}
\ No newline at end of file diff --git a/test/files/pos/t3582.scala b/test/files/pos/t3582.scala new file mode 100644 index 0000000000..0ac112efbf --- /dev/null +++ b/test/files/pos/t3582.scala @@ -0,0 +1,12 @@ +trait C[A] +object Test { + def ImplicitParamCA[CC[A], A](implicit ev: C[A]) {implicitly[C[A]]} // must use this exact syntax... + // error: could not find implicit value for parameter e: C[A] +} +// [[syntax trees at end of typer]] +// abstract trait C#5[A#9116 >: Nothing#5832 <: Any#52] extends scala#33.AnyRef#2780; +// final object Test#15 extends java.lang.Object#2485 with ScalaObject#1913 { +// def ImplicitParamCA#9123[CC#9124[A#10858 >: Nothing#5832 <: Any#52] >: [A#10858]Nothing#5832 <: [A#10858]Any#52, +// A#9125 >: Nothing#5832 <: Any#52](implicit ev#10856: C#5[A#9127]): Unit#3818 +// = scala#34.this.Predef#1683.implicitly#8816[C#5[A#10858]]() +// } diff --git a/test/files/pos/t3582b.scala b/test/files/pos/t3582b.scala new file mode 100644 index 0000000000..8f0bfb9b2a --- /dev/null +++ b/test/files/pos/t3582b.scala @@ -0,0 +1,5 @@ +object ParamScoping { + // scoping worked fine in the result type, but was wrong in body + // reason: typedTypeDef needs new context, which was set up by typed1 but not by typedDefDef and typedClassDef + def noOverlapFOwithHO[T, G[T]]: G[T] = null.asInstanceOf[G[T]] +}
\ No newline at end of file diff --git a/test/files/pos/t3622/test/AsyncTask.java b/test/files/pos/t3622/test/AsyncTask.java new file mode 100644 index 0000000000..cfcea3fe1a --- /dev/null +++ b/test/files/pos/t3622/test/AsyncTask.java @@ -0,0 +1,5 @@ +package test; + +public abstract class AsyncTask<Params, Progress, Result> { + protected abstract Result doInBackground(Params... args); +}
\ No newline at end of file diff --git a/test/files/pos/t3622/test/MyAsyncTask.java b/test/files/pos/t3622/test/MyAsyncTask.java new file mode 100644 index 0000000000..9ef4947052 --- /dev/null +++ b/test/files/pos/t3622/test/MyAsyncTask.java @@ -0,0 +1,9 @@ +package test; + +public abstract class MyAsyncTask extends AsyncTask<String, String, String> { + protected abstract String doInBackground1(String[] args); + @Override + protected String doInBackground(String... args) { + return doInBackground1(new String[]{"dummy"}); + } +}
\ No newline at end of file diff --git a/test/files/pos/t3622/test/Test.scala b/test/files/pos/t3622/test/Test.scala new file mode 100644 index 0000000000..fb82c581f9 --- /dev/null +++ b/test/files/pos/t3622/test/Test.scala @@ -0,0 +1,5 @@ +package test + +class Test extends MyAsyncTask { + protected[test] def doInBackground1(args: Array[String]): String = "" +}
\ No newline at end of file diff --git a/test/files/pos/t3676.scala b/test/files/pos/t3676.scala new file mode 100644 index 0000000000..60c0ceaec8 --- /dev/null +++ b/test/files/pos/t3676.scala @@ -0,0 +1,5 @@ +trait SeqLike[+Repr] +trait Seq extends SeqLike[Seq] + +trait MySeq extends Seq with SeqLike[MySub] +trait MySub extends MySeq diff --git a/test/files/pos/t3777.scala b/test/files/pos/t3777.scala new file mode 100644 index 0000000000..165eeebfdb --- /dev/null +++ b/test/files/pos/t3777.scala @@ -0,0 +1,7 @@ +object Test { + type Point = Map[Symbol, String] + type Points = IndexedSeq[Point] + + def makePoints2: Points = IndexedSeq[Point]() + val spoints2 = util.Random.shuffle(makePoints2) +} |