Skip to content

Commit 2e1b65e

Browse files
committed
fix experimental checking in un under
1 parent 3c2fa5e commit 2e1b65e

File tree

4 files changed

+9
-16
lines changed

4 files changed

+9
-16
lines changed

examples/shuffle_music.ua

-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +0,0 @@
1-
# Plays the `Music` song with a shuffled melody
2-
&ast⋅(
3-
Music
4-
♭↯2
5-
▽1.2
6-
⍜(⤸1 ≡(↘1⧈∘¤¤¯4) ⧈∘¤¤¯64)≡°⍆
7-
÷⟜⧈/+5
8-
)

src/compile/mod.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -2369,19 +2369,20 @@ impl Compiler {
23692369
where
23702370
S: ToString,
23712371
{
2372+
if !self.allow_experimental() {
2373+
self.scope.experimental_error = true;
2374+
self.add_error(span.clone(), message().to_string());
2375+
}
2376+
}
2377+
fn allow_experimental(&self) -> bool {
23722378
let take = self
23732379
.scopes()
23742380
.position(|sc| matches!(sc.kind, ScopeKind::File(_)))
23752381
.map(|i| i + 1)
23762382
.unwrap_or(usize::MAX);
2377-
if !self
2378-
.scopes()
2383+
self.scopes()
23792384
.take(take)
23802385
.any(|sc| sc.experimental || sc.experimental_error)
2381-
{
2382-
self.scope.experimental_error = true;
2383-
self.add_error(span.clone(), message().to_string());
2384-
}
23852386
}
23862387
fn error(&self, span: impl Into<Span>, message: impl ToString) -> UiuaError {
23872388
UiuaErrorKind::Run {

src/compile/modifier.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ impl Compiler {
846846
SigNode::new(sig, node)
847847
};
848848
let span = self.add_span(modified.modifier.span.clone());
849-
let un = if self.scope.experimental {
849+
let un = if self.allow_experimental() {
850850
if f.sig.args == f.sig.outputs {
851851
let (f_before, f_after) = f
852852
.node

todo.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# 0.15
44
- Allow unnamed data def outside named module
5-
- Subscripts `bits`
5+
- Subscripted `bits`
66
- Non-dyadic `backward`
77
- 0-output `tuples`
88
- Implement some `under` inverses in terms of `un by`, rather than the other way around

0 commit comments

Comments
 (0)