aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/dotc/tests.scala2
-rw-r--r--tests/pos/singletons.scala20
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 = ""
}
}
*/