diff options
author | Martin Odersky <odersky@gmail.com> | 2015-08-23 23:37:00 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-08-23 23:37:00 +0200 |
commit | e850a99f16004a702b5fa63736ac215fc388051b (patch) | |
tree | a24d2bfcb93c385d118f50b7cb71dd902108820e | |
parent | 289e273697f9304d716ed9fc834b3b2016df6f7d (diff) | |
download | dotty-e850a99f16004a702b5fa63736ac215fc388051b.tar.gz dotty-e850a99f16004a702b5fa63736ac215fc388051b.tar.bz2 dotty-e850a99f16004a702b5fa63736ac215fc388051b.zip |
Test other forms of singleton types.
Tested are now other numeric values, strings, booleans, which are
all legal singleton types.
-rw-r--r-- | test/dotc/tests.scala | 2 | ||||
-rw-r--r-- | tests/pos/singletons.scala | 20 |
2 files changed, 19 insertions, 3 deletions
diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala index a3fb8185b..8f8b1d04a 100644 --- a/test/dotc/tests.scala +++ b/test/dotc/tests.scala @@ -146,7 +146,7 @@ class tests extends CompilerTest { @Test def neg_instantiateAbstract = compileFile(negDir, "instantiateAbstract", xerrors = 8) @Test def neg_selfInheritance = compileFile(negDir, "selfInheritance", xerrors = 6) @Test def neg_selfreq = compileFile(negDir, "selfreq", xerrors = 4) - @Test def neg_singletons = compileFile(negDir, "singletons", xerrors = 2) + @Test def neg_singletons = compileFile(negDir, "singletons", xerrors = 4) @Test def neg_shadowedImplicits = compileFile(negDir, "arrayclone-new", xerrors = 2) @Test def neg_traitParamsTyper = compileFile(negDir, "traitParamsTyper", xerrors = 5) @Test def neg_traitParamsMixin = compileFile(negDir, "traitParamsMixin", xerrors = 2) diff --git a/tests/pos/singletons.scala b/tests/pos/singletons.scala index 55f9b5ecb..4ce41a061 100644 --- a/tests/pos/singletons.scala +++ b/tests/pos/singletons.scala @@ -12,8 +12,17 @@ object Test { val b: 2 = a def f: 3 = 3 - val c = f + final val c = f + val dc: 3.0 = 3.0 + final val dc1 = dc + val fc: 3.0f = 3.0f + final val fc1 = fc + + val t: true = true + + val str: "" = "" + final val str2 = str } /* To do: test that after erasure we have generated code like this: * @@ -34,7 +43,14 @@ package <empty> { } <accessor> def b(): Int = 2 def f(): Int = 3 - <accessor> def c(): Int = Test.f() + final <accessor> def c(): Int = Test.f() + <accessor> def dc(): Double = 3.0 + final <accessor> def dc1(): Double = 3.0 + <accessor> def fc(): Float = 3.0 + final <accessor> def fc1(): Float = 3.0 + <accessor> def t(): Boolean = true + <accessor> def str(): String = "" + final <accessor> def str2(): String = "" } } */ |