Skip to content

Commit 23b4a2d

Browse files
committed
Refine warning message
1 parent 72c545e commit 23b4a2d

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3111,7 +3111,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
31113111
i"Consider annotating the type as ${hi} or ${hi} | Null explicitly"
31123112
case _ => "Consider annotating the type explicitly"
31133113
report.warning(
3114-
em"Public ${if sym.is(Method) then "method" else "field"} ${sym.show} exposes a flexible type ${resTp} in its inferred signature. $suggestion",
3114+
em"Public ${sym.show} exposes a flexible type ${resTp} in its inferred signature. $suggestion",
31153115
sym.srcPos
31163116
)
31173117

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
11
-- Warning: tests/explicit-nulls/warn/expose-flexible-types.scala:2:6 --------------------------------------------------
22
2 | def f = s.trim // warn
33
| ^
4-
|Public method method f exposes a flexible type (String)? in its inferred signature. Consider annotating the type as String or String | Null explicitly
4+
|Public method f exposes a flexible type (String)? in its inferred signature. Consider annotating the type as String or String | Null explicitly
55
-- Warning: tests/explicit-nulls/warn/expose-flexible-types.scala:6:6 --------------------------------------------------
66
6 | def h = (s.trim, s.length) // warn
77
| ^
8-
|Public method method h exposes a flexible type ((String)?, Int) in its inferred signature. Consider annotating the type explicitly
8+
|Public method h exposes a flexible type ((String)?, Int) in its inferred signature. Consider annotating the type explicitly
99
-- Warning: tests/explicit-nulls/warn/expose-flexible-types.scala:7:6 --------------------------------------------------
1010
7 | val ss = s.replace("a", "A") // warn
1111
| ^
12-
|Public field value ss exposes a flexible type (String)? in its inferred signature. Consider annotating the type as String or String | Null explicitly
12+
|Public value ss exposes a flexible type (String)? in its inferred signature. Consider annotating the type as String or String | Null explicitly
1313
-- Warning: tests/explicit-nulls/warn/expose-flexible-types.scala:8:6 --------------------------------------------------
1414
8 | val ss2 = Seq(s.trim) // warn
1515
| ^
16-
|Public field value ss2 exposes a flexible type Seq[(String)?] in its inferred signature. Consider annotating the type explicitly
16+
|Public value ss2 exposes a flexible type Seq[(String)?] in its inferred signature. Consider annotating the type explicitly
1717
-- Warning: tests/explicit-nulls/warn/expose-flexible-types.scala:16:6 -------------------------------------------------
1818
16 | def f = s2.trim // warn
1919
| ^
20-
|Public method method f exposes a flexible type (String)? in its inferred signature. Consider annotating the type as String or String | Null explicitly
20+
|Public method f exposes a flexible type (String)? in its inferred signature. Consider annotating the type as String or String | Null explicitly
2121
-- Warning: tests/explicit-nulls/warn/expose-flexible-types.scala:20:6 -------------------------------------------------
2222
20 | def h = (s2.trim, s2.length) // warn
2323
| ^
24-
|Public method method h exposes a flexible type ((String)?, Int) in its inferred signature. Consider annotating the type explicitly
24+
|Public method h exposes a flexible type ((String)?, Int) in its inferred signature. Consider annotating the type explicitly
2525
-- Warning: tests/explicit-nulls/warn/expose-flexible-types.scala:21:6 -------------------------------------------------
2626
21 | val ss = s2.replace("a", "A") // warn
2727
| ^
28-
|Public field value ss exposes a flexible type (String)? in its inferred signature. Consider annotating the type as String or String | Null explicitly
28+
|Public value ss exposes a flexible type (String)? in its inferred signature. Consider annotating the type as String or String | Null explicitly
2929
-- Warning: tests/explicit-nulls/warn/expose-flexible-types.scala:22:6 -------------------------------------------------
3030
22 | val ss2 = Seq(s2.trim) // warn
3131
| ^
32-
|Public field value ss2 exposes a flexible type Seq[(String)?] in its inferred signature. Consider annotating the type explicitly
32+
|Public value ss2 exposes a flexible type Seq[(String)?] in its inferred signature. Consider annotating the type explicitly
3333
-- Warning: tests/explicit-nulls/warn/expose-flexible-types.scala:27:4 -------------------------------------------------
3434
27 |def f = s2.trim // warn
3535
| ^
36-
|Public method method f exposes a flexible type (String)? in its inferred signature. Consider annotating the type as String or String | Null explicitly
36+
|Public method f exposes a flexible type (String)? in its inferred signature. Consider annotating the type as String or String | Null explicitly
3737
-- Warning: tests/explicit-nulls/warn/expose-flexible-types.scala:31:4 -------------------------------------------------
3838
31 |def h = (s2.trim, s2.length) // warn
3939
| ^
40-
|Public method method h exposes a flexible type ((String)?, Int) in its inferred signature. Consider annotating the type explicitly
40+
|Public method h exposes a flexible type ((String)?, Int) in its inferred signature. Consider annotating the type explicitly
4141
-- Warning: tests/explicit-nulls/warn/expose-flexible-types.scala:32:4 -------------------------------------------------
4242
32 |val ss = s2.replace("a", "A") // warn
4343
| ^
44-
|Public field value ss exposes a flexible type (String)? in its inferred signature. Consider annotating the type as String or String | Null explicitly
44+
|Public value ss exposes a flexible type (String)? in its inferred signature. Consider annotating the type as String or String | Null explicitly
4545
-- Warning: tests/explicit-nulls/warn/expose-flexible-types.scala:33:4 -------------------------------------------------
4646
33 |val ss2 = Seq(s2.trim) // warn
4747
| ^
48-
|Public field value ss2 exposes a flexible type Seq[(String)?] in its inferred signature. Consider annotating the type explicitly
48+
|Public value ss2 exposes a flexible type Seq[(String)?] in its inferred signature. Consider annotating the type explicitly

0 commit comments

Comments
 (0)