From ecb75d7904b314df24b205b4f20328459ac43fcd Mon Sep 17 00:00:00 2001 From: i10416 Date: Sat, 24 Feb 2024 16:57:21 +0900 Subject: [PATCH] test: add test for #19762 Add a test to confirm issue#19762 is solved. [Cherry-picked 2a1d1b363afa61ea41b5149dc459908479088257] --- tests/neg/i19762.check | 6 ++++++ tests/neg/i19762.scala | 8 ++++++++ 2 files changed, 14 insertions(+) create mode 100644 tests/neg/i19762.check create mode 100644 tests/neg/i19762.scala diff --git a/tests/neg/i19762.check b/tests/neg/i19762.check new file mode 100644 index 000000000000..93def936e2a0 --- /dev/null +++ b/tests/neg/i19762.check @@ -0,0 +1,6 @@ +-- [E019] Syntax Error: tests/neg/i19762.scala:8:31 -------------------------------------------------------------------- +8 | def combine(x: Int, y: Int)) = x + y // error + | ^ + | Missing return type + | + | longer explanation available when compiling with `-explain` diff --git a/tests/neg/i19762.scala b/tests/neg/i19762.scala new file mode 100644 index 000000000000..4966f0d8cb53 --- /dev/null +++ b/tests/neg/i19762.scala @@ -0,0 +1,8 @@ +trait Monoid[A]: + def combine(x: A, y: A): A + def empty: A + +object Monoid: + lazy val addInt: Monoid[Int] = new: + val empty = 0 + def combine(x: Int, y: Int)) = x + y // error \ No newline at end of file