aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Typer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-03-14 09:44:17 +0100
committerMartin Odersky <odersky@gmail.com>2014-03-14 09:44:17 +0100
commit722661c0bada3a8e64512bda2ac7501b1c02ec10 (patch)
treea94c071b6eeea5092f3c01c48dd1e7ce421c48e2 /src/dotty/tools/dotc/typer/Typer.scala
parentdb950e5e168f6fd71a367da343e352139e8d653e (diff)
downloaddotty-722661c0bada3a8e64512bda2ac7501b1c02ec10.tar.gz
dotty-722661c0bada3a8e64512bda2ac7501b1c02ec10.tar.bz2
dotty-722661c0bada3a8e64512bda2ac7501b1c02ec10.zip
Fixed two problems with annotated types in patterns
Problem 1: The parser did not accept them. It has to accept a "RefinedType" as an ascription, not a "WithType" (as it did before), or even a "SimpleType" (as speced in the SyntaxSummary). Problem 2: Annotations are always typed as expressions. The annotations in question were typed as patterns before. Tests in Patterns.scala and in the Dotty compiler itself.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index c17c9d6d7..17c77be89 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -826,7 +826,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
}
def typedAnnotated(tree: untpd.Annotated, pt: Type)(implicit ctx: Context): Tree = track("typedAnnotated") {
- val annot1 = typed(tree.annot, defn.AnnotationClass.typeRef)
+ val annot1 = typedExpr(tree.annot, defn.AnnotationClass.typeRef)
val arg1 = typed(tree.arg, pt)
if (ctx.mode is Mode.Type)
assignType(cpy.Annotated(tree, annot1, arg1), annot1, arg1)