diff options
author | Lukas Rytz <lukas.rytz@epfl.ch> | 2012-07-13 16:28:42 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@epfl.ch> | 2012-07-18 09:21:52 +0200 |
commit | 776105a43ef7a7a7c32be8111b496a6762a8ac68 (patch) | |
tree | d37327c251552e61364a2509b9084ac0e30b3ad0 /test/files/neg | |
parent | 43dc4cc9f623a50f374feff28b67d7865c85d34c (diff) | |
download | scala-776105a43ef7a7a7c32be8111b496a6762a8ac68.tar.gz scala-776105a43ef7a7a7c32be8111b496a6762a8ac68.tar.bz2 scala-776105a43ef7a7a7c32be8111b496a6762a8ac68.zip |
SI-5892 allow implicit views in annotation args
the problem was that lazy annotations got completed in phase pickler.
the `inferView` method in Typers bails out if `isPastTyper`. now the
lazy annotations completes `atPhase(typerPhase)`. test case in `pos`.
the second test case in `neg` is for another bug that is discussed in
a comment of SI-5892. when type checking arguments of type parameter
annotations, the class members should not be in scope. this was alreay
fixed in 9129cfe9.
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/t5892.check | 17 | ||||
-rw-r--r-- | test/files/neg/t5892.scala | 25 |
2 files changed, 42 insertions, 0 deletions
diff --git a/test/files/neg/t5892.check b/test/files/neg/t5892.check new file mode 100644 index 0000000000..839bf9de23 --- /dev/null +++ b/test/files/neg/t5892.check @@ -0,0 +1,17 @@ +t5892.scala:5: error: type mismatch; + found : Boolean(false) + required: String +class C[@annot(false) X] { + ^ +t5892.scala:9: error: not found: value b2s +class D[@annot(b2s(false)) X] { + ^ +t5892.scala:13: error: type mismatch; + found : Boolean(false) + required: String +@annot(false) class E { + ^ +t5892.scala:17: error: not found: value b2s +@annot(b2s(false)) class F { + ^ +four errors found diff --git a/test/files/neg/t5892.scala b/test/files/neg/t5892.scala new file mode 100644 index 0000000000..5e3b2f313e --- /dev/null +++ b/test/files/neg/t5892.scala @@ -0,0 +1,25 @@ +import language.implicitConversions + +class annot(a: String) extends annotation.StaticAnnotation + +class C[@annot(false) X] { + implicit def b2s(b: Boolean): String = "" +} + +class D[@annot(b2s(false)) X] { + implicit def b2s(b: Boolean): String = "" +} + +@annot(false) class E { + implicit def b2s(b: Boolean): String = "" +} + +@annot(b2s(false)) class F { + implicit def b2s(b: Boolean): String = "" +} + +object T { + implicit def b2s(b: Boolean): String = "" + @annot(false) val x = 0 + @annot(b2s(false)) val y = 0 +} |