@@ -372,6 +372,43 @@ class ReplCompilerTests extends ReplTest:
372
372
assertTrue(last, last.startsWith(" val res0: tpolecat.type = null" ))
373
373
assertTrue(last, last.endsWith(""" // result of "res0.toString" is null""" ))
374
374
375
+ @ Test def `i21431 filter out best effort options` : Unit =
376
+ initially :
377
+ run(" :settings -Ybest-effort -Ywith-best-effort-tasty" )
378
+ .andThen:
379
+ run(" 0" ) // check for crash
380
+ val last = lines()
381
+ assertTrue(last(0 ), last(0 ) == (" Options incompatible with repl will be ignored: -Ybest-effort, -Ywith-best-effort-tasty" ))
382
+ assertTrue(last(1 ), last(1 ) == (" val res0: Int = 0" ))
383
+
384
+ @ Test def `i9879` : Unit = initially :
385
+ run {
386
+ """ |opaque type A = Int; def getA: A = 0
387
+ |object Wrapper { opaque type A = Int; def getA: A = 1 }
388
+ |val x = getA
389
+ |val y = Wrapper.getA""" .stripMargin
390
+ }
391
+ val expected = List (
392
+ " def getA: A" ,
393
+ " // defined object Wrapper" ,
394
+ " val x: A = 0" ,
395
+ " val y: Wrapper.A = 1"
396
+ )
397
+ assertEquals(expected, lines())
398
+
399
+ @ Test def `i9879b` : Unit = initially :
400
+ run {
401
+ """ |def test =
402
+ | type A = Int
403
+ | opaque type B = String
404
+ | object Wrapper { opaque type C = Int }
405
+ | ()""" .stripMargin
406
+ }
407
+ val all = lines()
408
+ assertEquals(6 , all.length)
409
+ assertTrue(all.head.startsWith(" -- [E103] Syntax Error" ))
410
+ assertTrue(all.exists(_.trim().startsWith(" | Illegal start of statement: this modifier is not allowed here" )))
411
+
375
412
object ReplCompilerTests :
376
413
377
414
private val pattern = Pattern .compile(" \\ r[\\ n]?|\\ n" );
0 commit comments