diff options
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/bug1275.scala | 2 | ||||
-rw-r--r-- | test/files/neg/bug608.check | 8 | ||||
-rw-r--r-- | test/files/neg/bug608.scala | 24 | ||||
-rw-r--r-- | test/files/neg/bug987.scala | 2 | ||||
-rw-r--r-- | test/files/neg/t2139.check | 6 | ||||
-rw-r--r-- | test/files/neg/t2139.scala | 15 |
6 files changed, 39 insertions, 18 deletions
diff --git a/test/files/neg/bug1275.scala b/test/files/neg/bug1275.scala index 7b9b044346..e9be13c763 100644 --- a/test/files/neg/bug1275.scala +++ b/test/files/neg/bug1275.scala @@ -1,4 +1,4 @@ -// tested using Scala compiler version 2.6.0-RC1 -- (c) 2002-2009 LAMP/EPFL +// tested using Scala compiler version 2.6.0-RC1 -- (c) 2002-2010 LAMP/EPFL // prompted by "Covariant return types" mailing list question object TestCovariance { diff --git a/test/files/neg/bug608.check b/test/files/neg/bug608.check index 4e8eb4d709..a8e32e4c10 100644 --- a/test/files/neg/bug608.check +++ b/test/files/neg/bug608.check @@ -1,6 +1,6 @@ bug608.scala:16: error: type mismatch; - found : (a) => a - required: (ha) => ? - = g(f(x).bimap(id)) - ^ + found : hs{type a = ha} + required: hs{type s = hs; type a = ha} + = g(f(x).bimap(id)) + ^ one error found diff --git a/test/files/neg/bug608.scala b/test/files/neg/bug608.scala index 24f515651a..34dc4c0352 100644 --- a/test/files/neg/bug608.scala +++ b/test/files/neg/bug608.scala @@ -1,17 +1,17 @@ trait CrashDueToTypeError { - def id[a](x :a) :a = x + def id[a](x :a) :a = x - trait Bifunctor { - type a; // content - type s <: Bifunctor + trait Bifunctor { + type a; // content + type s <: Bifunctor - // uncomment this-vvvvvvvvvvvvvvvvvvvvvvvvvvvv, and it compiles - def bimap[c](f :a=>c) :s{/*type s=Bifunctor.this.s;*/type a=c; } - } + // uncomment this-vvvvvvvvvvvvvvvvvvvvvvvvvvvv, and it compiles + def bimap[c](f :a=>c) :s{/*type s=Bifunctor.this.s;*/type a=c; } + } - def hylo[hs <: Bifunctor,ha,hb,hc] - (f :hb=>hs{type s=hs; type a=ha}, - g :hs{type s=hs; type a=ha}=>hc)(x :hb) - :hc - = g(f(x).bimap(id)) + def hylo[hs <: Bifunctor,ha,hb,hc] + (f :hb=>hs{type s=hs; type a=ha}, + g :hs{type s=hs; type a=ha}=>hc)(x :hb) + :hc + = g(f(x).bimap(id)) } diff --git a/test/files/neg/bug987.scala b/test/files/neg/bug987.scala index 0c65b98049..5b2addf5ef 100644 --- a/test/files/neg/bug987.scala +++ b/test/files/neg/bug987.scala @@ -1,4 +1,4 @@ -// tested using Scala compiler version 2.4.0-RC1 -- (c) 2002-2009 LAMP/EPFL +// tested using Scala compiler version 2.4.0-RC1 -- (c) 2002-2010 LAMP/EPFL // Many thanks to all at LAMP for the work that goes into Scala. diff --git a/test/files/neg/t2139.check b/test/files/neg/t2139.check new file mode 100644 index 0000000000..e26f290761 --- /dev/null +++ b/test/files/neg/t2139.check @@ -0,0 +1,6 @@ +t2139.scala:13: error: type mismatch; + found : Int(4) + required: Nothing + val z:Int=(u.f _)(4) + ^ +one error found diff --git a/test/files/neg/t2139.scala b/test/files/neg/t2139.scala new file mode 100644 index 0000000000..4f09b5a5d1 --- /dev/null +++ b/test/files/neg/t2139.scala @@ -0,0 +1,15 @@ +/* + NOTE: if inference is changed so that + T is inferred to be Int, rather than Nothing, + the piece of code below will start to compile OK. + In that case, see ticket #2139, and make sure that + the generated code will no longer crash! +*/ +class U { + def f[T](x:T):T=x +} +object H extends Application { + val u=new U + val z:Int=(u.f _)(4) + println("done") +} |