aboutsummaryrefslogtreecommitdiff
path: root/compiler/test/dotty
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2017-02-20 18:54:29 +0100
committerGitHub <noreply@github.com>2017-02-20 18:54:29 +0100
commitf467be62da8978e506f58b702b84e74ef7ce09de (patch)
tree1ac2e53a51bb60b8ab7bd7e554fa071f0252f7df /compiler/test/dotty
parentf76ffe97f9460cc04e159ce5b2c0b83d63fb940c (diff)
parent6b522cc16ee61b51c5b0c5ff4df3632c2d84e801 (diff)
downloaddotty-f467be62da8978e506f58b702b84e74ef7ce09de.tar.gz
dotty-f467be62da8978e506f58b702b84e74ef7ce09de.tar.bz2
dotty-f467be62da8978e506f58b702b84e74ef7ce09de.zip
Merge pull request #2007 from dotty-staging/ennru_MixedLeftAndRightAssoc
mixed left and right assoc
Diffstat (limited to 'compiler/test/dotty')
-rw-r--r--compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala23
1 files changed, 23 insertions, 0 deletions
diff --git a/compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala b/compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala
index 697a00510..37d1404bb 100644
--- a/compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala
+++ b/compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala
@@ -136,4 +136,27 @@ class ErrorMessagesTests extends ErrorMessagesTest {
""".stripMargin
}
.expectNoErrors
+
+ @Test def leftAndRightAssociative =
+ checkMessagesAfter("frontend") {
+ """
+ |object Ops {
+ | case class I(j: Int) {
+ | def +-(i: Int) = i
+ | def +:(i: Int) = i
+ | }
+ | val v = I(1) +- I(4) +: I(4)
+ |}
+ """.stripMargin
+ }
+ .expect { (ictx, messages) =>
+ implicit val ctx: Context = ictx
+ val defn = ictx.definitions
+
+ assertMessageCount(1, messages)
+ val MixedLeftAndRightAssociativeOps(op1, op2, op2LeftAssoc) :: Nil = messages
+ assertEquals("+-", op1.show)
+ assertEquals("+:", op2.show)
+ assertFalse(op2LeftAssoc)
+ }
}