diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2016-06-02 11:57:35 +0200 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2016-06-02 11:57:35 +0200 |
commit | 07c5a0ae7281616c410bf7f4397de844c59327ab (patch) | |
tree | 38354fcbe2271e361f5be7809ddff12dd39b6856 /src/dotty/tools/dotc/parsing/Scanners.scala | |
parent | fabe697b881915da87e6ad253ca987dbc9a8d1ca (diff) | |
download | dotty-07c5a0ae7281616c410bf7f4397de844c59327ab.tar.gz dotty-07c5a0ae7281616c410bf7f4397de844c59327ab.tar.bz2 dotty-07c5a0ae7281616c410bf7f4397de844c59327ab.zip |
Fix #1292: give position when failing to emit switch on annotated match
This fix gives the position and refactors the code that gave off
warnings, but it also begs the question - should we be able to handle
emitting a switch for the following case:
```scala
(x: @switch) match {
case 'a' if somePredicate(x) => // ...
case 'b' => // ...
}
```
Currently if there is a guard, the patternmatcher will fail to emit
a switch. Scalac can handle these cases currently.
Diffstat (limited to 'src/dotty/tools/dotc/parsing/Scanners.scala')
-rw-r--r-- | src/dotty/tools/dotc/parsing/Scanners.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/parsing/Scanners.scala b/src/dotty/tools/dotc/parsing/Scanners.scala index 6fe86502f..1355ea386 100644 --- a/src/dotty/tools/dotc/parsing/Scanners.scala +++ b/src/dotty/tools/dotc/parsing/Scanners.scala @@ -922,8 +922,8 @@ object Scanners { getFraction() } } else (ch: @switch) match { - case 'e' | 'E' | 'f' | 'F' | 'd' | 'D' if base == 10 => - getFraction() + case 'e' | 'E' | 'f' | 'F' | 'd' | 'D' => + if (base == 10) getFraction() case 'l' | 'L' => nextChar() token = LONGLIT |