Skip to content

Commit e46ff69

Browse files
authored
Don’t require a newline after a type mismatch error reported by the compiler (#1165)
Currently, the compiler incorrectly reports errors like: ~~~ text [error] val n: Int = 0; val s: Int = n + "hello" [error] ^ [error] Found: String [error] Required: Int [error] [error] One of the following imports might make progress towards fixing the problem: [error] [error] import org.specs2.io.FileName.ToFileName [error] import org.specs2.TimeoutSpecExample.asExecutionIsInterpolated [error] import org.specs2.reflect.FromObjectName.asExecutionIsInterpolated [error] import org.specs2.reporter.reporterSpecSupport.asExecutionIsInterpolated [error] import org.specs2.runner.RunnerSpecification.asExecutionIsInterpolated [error] import org.specs2.specification.S1.asExecutionIsInterpolated [error] import org.specs2.specification.S2.asExecutionIsInterpolated [error] import org.specs2.specification.dsl1.asExecutionIsInterpolated [error] import org.specs2.TimeoutSpecExample.asResultIsInterpolated [error] import org.specs2.reflect.FromObjectName.asResultIsInterpolated ~~~ But after scala/scala3#17924 is merged, the import suggestions will be removed from the output. We adjust the test specification in TypecheckSpec to pass both with the current compiler and with the fix in the linked PR.
1 parent 5a84743 commit e46ff69

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

core/shared/src/test/scala/org/specs2/matcher/TypecheckSpec.scala

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ class TypecheckSpec extends Specification:
3434
result must beFailing(startWith("""|val n: Int = 0; val s: Int = n + "hello"
3535
| ^
3636
|Found: String
37-
|Required: Int
38-
|""".stripMargin))
37+
|Required: Int""".stripMargin))
3938

4039
def e3 =
4140
def code1 = """val n: Int = "x"; """
@@ -47,15 +46,13 @@ class TypecheckSpec extends Specification:
4746
result must beFailing(startWith("""|val n: Int = "x"; val s: Int = "y"
4847
| ^
4948
|Found: ("x" : String)
50-
|Required: Int
51-
|""".stripMargin))
49+
|Required: Int""".stripMargin))
5250

5351
result match
5452
case Failure(_, _, _, FailureDetailsMessages(messages)) =>
5553
messages(0) must startWith("""|val n: Int = "x"; val s: Int = "y"
5654
| ^
5755
|Found: ("y" : String)
58-
|Required: Int
59-
|""".stripMargin)
56+
|Required: Int""".stripMargin)
6057
case other =>
6158
failure(s"unexpected $other")

0 commit comments

Comments
 (0)