Scala Programming Language
  1. Scala Programming Language
  2. SI-7473

Typo in for expr crashes, = instead of <-, NoPosition is pointless

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: Scala 2.10.1
    • Fix Version/s: Scala 2.10.3-RC1
    • Component/s: Misc Compiler
    • Labels:
      None

      Description

      Oops, I did it again. Butter fingers!

      Instead of crashing, I'd propose a message like, "I'll bring the popcorn!"

      apm@mara:~$ skala
      Welcome to Scala version 2.11.0-20130422-021742-1d54f26b9a (OpenJDK 64-Bit Server VM, Java 1.7.0_21).
      Type in expressions to have them evaluated.
      Type :help for more information.
      
      scala> val i = 3
      i: Int = 3
      
      scala> val j = 3
      j: Int = 3
      
      scala> (for (x = Option(i); if x == j) yield 42) toList
      <console>:1: error: '<-' expected but '=' found.
             (for (x = Option(i); if x == j) yield 42) toList
                     ^
      <console>:1: error: illegal start of simple expression
             (for (x = Option(i); if x == j) yield 42) toList
                                ^
      java.lang.UnsupportedOperationException: Position.point on class scala.reflect.internal.util.NoPosition$
      	at scala.reflect.internal.util.Position.point(Position.scala:115)
      	at scala.reflect.internal.util.Position.startOrPoint(Position.scala:112)
      	at scala.tools.nsc.ast.parser.Parsers$Parser.postfixExpr(Parsers.scala:1444)
      	at scala.tools.nsc.ast.parser.Parsers$Parser.parseOther$1(Parsers.scala:1339)
      	at scala.tools.nsc.ast.parser.Parsers$Parser.expr0(Parsers.scala:1393)
      	at scala.tools.nsc.ast.parser.Parsers$Parser.expr(Parsers.scala:1235)
      

      Also in 2.10.1. Is NoPosition the new NoSymbol has no owner?

        Issue Links

          Activity

          Show
          A. P. Marki added a comment - https://github.com/scala/scala/pull/2583

            People

            • Assignee:
              A. P. Marki
              Reporter:
              A. P. Marki
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development