From 17a441d93a14c578a1a84ea0f3f9bd090ba26fb8 Mon Sep 17 00:00:00 2001 From: Iulian Dragos Date: Fri, 4 Sep 2009 16:46:58 +0000 Subject: Fixed #2095. --- src/compiler/scala/tools/nsc/typechecker/Typers.scala | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 372f8965e4..59b345dd6f 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1392,6 +1392,8 @@ trait Typers { self: Analyzer => var tpt1 = checkNoEscaping.privates(sym, typer1.typedType(vdef.tpt)) checkNonCyclic(vdef, tpt1) + if (sym.hasAnnotation(definitions.VolatileAttr) && !sym.hasFlag(MUTABLE)) + error(vdef.pos, "values cannot be volatile") val rhs1 = if (vdef.rhs.isEmpty) { if (sym.isVariable && sym.owner.isTerm && phase.id <= currentRun.typerPhase.id) -- cgit v1.2.3