Skip to content

Commit ae0a3e9

Browse files
authored
disallow begin inside indexing (#25614)
part of #23354, #25458
1 parent 4f57e0a commit ae0a3e9

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

NEWS.md

+3
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,9 @@ Language changes
185185
* `=>` now has its own precedence level, giving it strictly higher precedence than
186186
`=` and `,` ([#25391]).
187187

188+
* `begin` is disallowed inside indexing expressions, in order to enable the syntax
189+
`a[begin]` (for selecting the first element) in the future ([#23354]).
190+
188191
* Underscores for `_italics_` and `__bold__` are now supported by the Base Markdown
189192
parser. ([#25564])
190193

src/julia-parser.scm

+2
Original file line numberDiff line numberDiff line change
@@ -1318,6 +1318,8 @@
13181318

13191319
;; parse expressions or blocks introduced by syntactic reserved words
13201320
(define (parse-resword s word)
1321+
(if (and (eq? word 'begin) end-symbol)
1322+
(parser-depwarn s "\"begin\" inside indexing expression" ""))
13211323
(with-bindings
13221324
((expect-end-current-line (input-port-line (ts:port s))))
13231325
(with-normal-context

0 commit comments

Comments
 (0)