summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2007-02-02 18:35:47 +0000
committerMartin Odersky <odersky@gmail.com>2007-02-02 18:35:47 +0000
commit3eae42f4cc89fde2fffe2861c024341cf1ce700b (patch)
tree566e9ba4aed87a175df10ad43ca8eb6d5fcdaaed
parent828377d9c0c86471a1c18ba11ff13460400729cf (diff)
downloadscala-3eae42f4cc89fde2fffe2861c024341cf1ce700b.tar.gz
scala-3eae42f4cc89fde2fffe2861c024341cf1ce700b.tar.bz2
scala-3eae42f4cc89fde2fffe2861c024341cf1ce700b.zip
added comment & test case
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala2
-rw-r--r--test/files/neg/sensitive.check4
-rw-r--r--test/files/neg/sensitive.scala19
3 files changed, 24 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index 7450aea91e..e543e54bce 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -2124,7 +2124,7 @@ trait Parsers requires SyntaxAnalyzer {
attrs.toList
}
- /** Attribute ::= StableId [TypeArgs] [`(' [Exprs] `)']
+ /** Attribute ::= StableId [TypeArgs] [`(' [Exprs] `)'] [`{' {NameValuePair} `}']
*/
def attribute(): Attribute = {
def nameValuePair(): Tree = {
diff --git a/test/files/neg/sensitive.check b/test/files/neg/sensitive.check
new file mode 100644
index 0000000000..aa7c65a3b1
--- /dev/null
+++ b/test/files/neg/sensitive.check
@@ -0,0 +1,4 @@
+sensitive.scala:17: error: constructor Sensitive cannot be accessed in object Attacker
+ val y = new Sensitive()
+ ^
+one error found
diff --git a/test/files/neg/sensitive.scala b/test/files/neg/sensitive.scala
new file mode 100644
index 0000000000..f435a385e1
--- /dev/null
+++ b/test/files/neg/sensitive.scala
@@ -0,0 +1,19 @@
+class Certificate{}
+
+object Admin extends Certificate;
+
+class SecurityViolationException extends Exception
+
+object Sensitive {
+ def makeSensitive(credentials: Certificate): Sensitive =
+ if (credentials == Admin) new Sensitive()
+ else throw new SecurityViolationException
+}
+class Sensitive private () {
+}
+
+object Attacker {
+ val x = Sensitive.makeSensitive(null)
+ val y = new Sensitive()
+}
+