From 5b54681d0360616efdb2a561ce9201fbd67e7288 Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Thu, 23 May 2013 00:28:45 -0700 Subject: SI-7473 Bad for expr crashes postfix This commit makes building PostfixSelect robust against a bad pos on its operand, which can happen if a bad for expression results in an EmptyTree. --- test/files/neg/t7473.check | 7 +++++++ test/files/neg/t7473.scala | 7 +++++++ 2 files changed, 14 insertions(+) create mode 100644 test/files/neg/t7473.check create mode 100644 test/files/neg/t7473.scala (limited to 'test/files') diff --git a/test/files/neg/t7473.check b/test/files/neg/t7473.check new file mode 100644 index 0000000000..bc8c29d463 --- /dev/null +++ b/test/files/neg/t7473.check @@ -0,0 +1,7 @@ +t7473.scala:6: error: '<-' expected but '=' found. + (for (x = Option(i); if x == j) yield 42) toList + ^ +t7473.scala:6: error: illegal start of simple expression + (for (x = Option(i); if x == j) yield 42) toList + ^ +two errors found diff --git a/test/files/neg/t7473.scala b/test/files/neg/t7473.scala new file mode 100644 index 0000000000..593231d5f2 --- /dev/null +++ b/test/files/neg/t7473.scala @@ -0,0 +1,7 @@ + +object Foo { + val i,j = 3 + //for (x = Option(i); if x == j) yield 42 //t7473.scala:4: error: '<-' expected but '=' found. + // evil postfix! + (for (x = Option(i); if x == j) yield 42) toList +} -- cgit v1.2.3