Skip to content

Revert "Implement SIP-42 - Support for binary integer literals" #19694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/parsing/Scanners.scala
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ object Scanners {
nextChar()
ch match {
case 'x' | 'X' => base = 16 ; nextChar()
case 'b' | 'B' => base = 2 ; nextChar()
//case 'b' | 'B' => base = 2 ; nextChar()
case _ => base = 10 ; putChar('0')
}
if (base != 10 && !isNumberSeparator(ch) && digit2int(ch, base) < 0)
Expand Down
19 changes: 0 additions & 19 deletions docs/_docs/reference/other-new-features/binary-literals.md

This file was deleted.

5 changes: 2 additions & 3 deletions docs/_spec/01-lexical-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,9 @@ Literal ::= [‘-’] integerLiteral
### Integer Literals

```ebnf
integerLiteral ::= (decimalNumeral | hexNumeral | binaryNumeral) [‘L’ | ‘l’]
integerLiteral ::= (decimalNumeral | hexNumeral) [‘L’ | ‘l’]
decimalNumeral ::= ‘0’ | digit [{digit | ‘_’} digit]
hexNumeral ::= ‘0’ (‘x’ | ‘X’) hexDigit [{hexDigit | ‘_’} hexDigit]
binaryNumeral ::= ‘0’ (‘b’ | ‘B’) binaryDigit [{binaryDigit | ‘_’} binaryDigit]
```

Values of type `Int` are all integer numbers between $-2\^{31}$ and $2\^{31}-1$, inclusive.
Expand All @@ -358,7 +357,7 @@ The numeric ranges given by these types are:
The digits of a numeric literal may be separated by arbitrarily many underscores for purposes of legibility.

> ```scala
> 0 21_000 0x7F -42L 0xFFFF_FFFF 0b0100_0010
> 0 21_000 0x7F -42L 0xFFFF_FFFF
> ```

### Floating Point Literals
Expand Down
1 change: 0 additions & 1 deletion docs/sidebar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ subsection:
- page: reference/other-new-features/safe-initialization.md
- page: reference/other-new-features/type-test.md
- page: reference/other-new-features/experimental-defs.md
- page: reference/other-new-features/binary-literals.md
- title: Other Changed Features
directory: changed-features
index: reference/changed-features/changed-features.md
Expand Down
1 change: 0 additions & 1 deletion project/resources/referenceReplacements/sidebar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ subsection:
- page: reference/other-new-features/safe-initialization.md
- page: reference/other-new-features/type-test.md
- page: reference/other-new-features/experimental-defs.md
- page: reference/other-new-features/binary-literals.md
- title: Other Changed Features
directory: changed-features
index: reference/changed-features/changed-features.md
Expand Down
8 changes: 0 additions & 8 deletions tests/neg/binaryLiterals.scala

This file was deleted.

72 changes: 0 additions & 72 deletions tests/run/binaryLiterals.scala

This file was deleted.