From 722661c0bada3a8e64512bda2ac7501b1c02ec10 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 14 Mar 2014 09:44:17 +0100 Subject: 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. --- src/dotty/tools/dotc/typer/Typer.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/dotty/tools/dotc/typer/Typer.scala') 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) -- cgit v1.2.3