|
1 |
| -trait RejectedLiterals { |
2 |
| - def missingHex: Int = { 0x } // error: invalid literal number |
3 |
| -} |
4 |
| -/* |
5 |
| -// nsc: -Ywarn-octal-literal -Xfatal-warnings -deprecation |
6 | 1 | trait RejectedLiterals {
|
7 | 2 |
|
8 |
| - def missingHex: Int = { 0x } // line 4: was: not reported, taken as zero |
| 3 | + def missingHex: Int = { 0x } // error: invalid literal number |
9 | 4 |
|
10 | 5 | def leadingZeros: Int = { 01 } // line 6: no leading zero
|
11 | 6 |
|
12 | 7 | def tooManyZeros: Int = { 00 } // line 8: no leading zero
|
13 | 8 |
|
14 | 9 | def zeroOfNine: Int = { 09 } // line 10: no leading zero
|
15 | 10 |
|
16 |
| - def orphanDot: Int = { 9. } // line 12: ident expected |
| 11 | + def orphanDot: Int = { 9. } // error: ident expected |
17 | 12 |
|
18 |
| - def zeroOfNineDot: Int = { 09. } // line 14: malformed integer, ident expected |
| 13 | + def zeroOfNineDot: Int = { 09. } // error: malformed integer, ident expected |
19 | 14 |
|
20 |
| - def noHexFloat: Double = { 0x1.2 } // line 16: ';' expected but double literal found. |
| 15 | + def noHexFloat: Double = { 0x1.2 } // error: ';' expected but double literal found. |
21 | 16 |
|
22 | 17 | }
|
23 | 18 |
|
24 | 19 | trait Braceless {
|
25 | 20 |
|
26 |
| - def missingHex: Int = 0x // line 22: was: not reported, taken as zero |
| 21 | + def missingHex: Int = 0x // error: was: not reported, taken as zero |
27 | 22 |
|
28 | 23 | def leadingZeros: Int = 01 // line 24: no leading zero
|
29 | 24 |
|
30 | 25 | def tooManyZeros: Int = 00 // line 26: no leading zero
|
31 | 26 |
|
32 | 27 | def zeroOfNine: Int = 09 // line 28: no leading zero
|
33 | 28 |
|
34 |
| - def orphanDot: Int = 9. // line 30: ident expected |
| 29 | + def orphanDot: Int = 9. // should be: ident expected |
35 | 30 |
|
36 |
| - def zeroOfNineDot: Int = 09. // line 32: malformed integer, ident expected |
| 31 | + def zeroOfNineDot: Int = 09. // error: an identifier expected, but 'def' found, shoule be ident expected |
37 | 32 |
|
38 |
| - def noHexFloat: Double = 0x1.2 // line 34: ';' expected but double literal found. |
| 33 | + def noHexFloat: Double = 0x1.2 // should be: ';' expected but double literal found. |
39 | 34 | }
|
40 | 35 |
|
41 | 36 | trait MoreSadness {
|
42 | 37 |
|
43 |
| - def tooTiny: Float = { 0.7e-45f } // floating point number too small |
| 38 | + def tooTiny: Float = { 0.7e-45f } // error: floating point number too small |
44 | 39 |
|
45 |
| - def twoTiny: Double = { 2.0e-324 } // double precision floating point number too small |
| 40 | + def twoTiny: Double = { 2.0e-324 } // error: double precision floating point number too small |
46 | 41 |
|
47 |
| - def tooHuge: Float = { 3.4028236E38f } // floating point number too large |
| 42 | + def tooHuge: Float = { 3.4028236E38f } // error: floating point number too large |
48 | 43 |
|
49 |
| - def twoHuge: Double = { 1.7976931348623159e308 } // double precision floating point number too large |
50 |
| -} |
| 44 | + def twoHuge: Double = { 1.7976931348623159e308 } // error: double precision floating point number too large |
| 45 | +} // error: Found: Unit etc, sad |
51 | 46 |
|
52 | 47 | trait Lengthy {
|
53 | 48 |
|
54 | 49 | def bad = 1l
|
55 | 50 |
|
56 | 51 | def worse = 123l
|
57 |
| -} |
58 |
| -*/ |
| 52 | +} // error: Found: Unit etc, sad // anypos-error: '}' expected, but eof found, sad |
0 commit comments