File tree 1 file changed +4
-24
lines changed
src/dotty/tools/dotc/reporting/diagnostic
1 file changed +4
-24
lines changed Original file line number Diff line number Diff line change @@ -407,26 +407,6 @@ object messages {
407
407
408
408
val msg = hl " unbound placeholder parameter; incorrect use of `_` "
409
409
410
- val codeUnboundInBlock =
411
- """
412
- |{ _ }
413
- """ .stripMargin
414
-
415
- val codeBoundInBlock =
416
- """
417
- |x => { x }
418
- """ .stripMargin
419
-
420
- val codeUnboundVal =
421
- """
422
- |val a = _
423
- """ .stripMargin
424
-
425
- val codeVar =
426
- """
427
- |var a = _
428
- """ .stripMargin
429
-
430
410
val explanation =
431
411
hl """ The `_` placeholder syntax was used where it could not be bound.
432
412
|Consider explicitly writing the variable binding.
@@ -436,21 +416,21 @@ object messages {
436
416
|
437
417
|Example before:
438
418
|
439
- | $codeUnboundInBlock
419
+ | ${ " { _ } " }
440
420
|
441
421
|Example after:
442
422
|
443
- | $codeBoundInBlock
423
+ | ${ " x => { x } " }
444
424
|
445
425
|Another common occurrence for this error is defining a val with `_`:
446
426
|
447
- | $codeUnboundVal
427
+ | ${ " val a = _ " }
448
428
|
449
429
|But this val definition isn't very useful, it can never be assigned
450
430
|another value. And thus will always remain uninitialized.
451
431
|Consider replacing the ${" val" } with ${" var" }:
452
432
|
453
- | $codeVar
433
+ | ${ " var a = _ " }
454
434
|
455
435
|Note that this use of `_` is not placeholder syntax,
456
436
|but an uninitialized var definition
You can’t perform that action at this time.
0 commit comments