Skip to content

Commit 79d57c9

Browse files
committed
prevent private unnamed data defs
1 parent 1bb3546 commit 79d57c9

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This version is not yet released. If you are reading this on the website, then t
1111
- **Breaking Change** - Numeric subscripted [`join ⊂`](https://uiua.org/docs/join) now joins that many arrays
1212
- **Breaking Change** - Remove combining `e` number literals
1313
- It was confusing when combined with `e` scientific number notation
14-
- Allow for private [modules](https://uiua.org/tutorial/modules#private-scoped-modules), [imports](/tutorial/modules#private-imports), and [data definitions](https://uiua.org/tutorial/datadefs#visibility)
14+
- Allow for private [modules](https://uiua.org/tutorial/modules#private-scoped-modules), [imports](https://uiua.org/tutorial/modules#private-imports), and [data definitions](https://uiua.org/tutorial/datadefs#visibility)
1515
- Add array pack syntactic sugar. This lets you write code like `[⊃(+|×)]` as `⊃[+|×]`.
1616
- Subscripts can now be typed with `,` instead of `__`s
1717
- Add numeric subscripts for [`keep ▽`](https://uiua.org/docs/keep) to keep along a number of dimensions

src/compile/data.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ impl Compiler {
7979
data.span(),
8080
"A module cannot have multiple unnamed data definitions",
8181
));
82+
} else if !data.public {
83+
self.add_error(
84+
data.init_span.clone(),
85+
"Unnamed data definitions cannot be marked private",
86+
);
8287
}
8388
}
8489

tests_special/error.ua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,8 @@ M~G
166166
G ↚ 5
167167
└─╴
168168
M~G
169+
170+
┌─╴M
171+
≁ {A}
172+
└─╴
173+
M 5

0 commit comments

Comments
 (0)