feat(lang): 0.S - a reference out of a read-only state is read-only (named so), a program's type named like the runtime's is refused (PadButton), tests for both, the migrate case covers lets; changeset
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
02448e176c
commit
c167ecc714
10 changed files with 13858 additions and 13042 deletions
9
examples/rejected/module_let_alias.ludic
Normal file
9
examples/rejected/module_let_alias.ludic
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# 0.S: a module-level let is immutable all the way down, through a local that holds it too
|
||||
program ModuleLetAlias {
|
||||
let LIMITS: []int = [1, 2]
|
||||
entry {
|
||||
let l = LIMITS
|
||||
push(l, 3)
|
||||
print(len(LIMITS))
|
||||
}
|
||||
}
|
||||
10
examples/rejected/runtime_type_clash.ludic
Normal file
10
examples/rejected/runtime_type_clash.ludic
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# a program's type named like one the runtime declares is refused (it compiled, and the two layouts
|
||||
# met in the IR): the runtime's input has `enum PadButton`
|
||||
program RuntimeTypeClash {
|
||||
property PadButton { code: int = 0 }
|
||||
entry {
|
||||
let b = new PadButton
|
||||
print(b.code)
|
||||
print(Input.pad_button(0, 1))
|
||||
}
|
||||
}
|
||||
13
examples/rejected/state_alias_readonly.ludic
Normal file
13
examples/rejected/state_alias_readonly.ludic
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# 0.S: a reference read out of a read-only state is read-only too
|
||||
program StateAliasReadonly {
|
||||
property Row { n: int = 0 }
|
||||
state Table { rows: []Row = new []Row }
|
||||
function bump(t: Table) -> void {
|
||||
let r = t.rows[0]
|
||||
r.n = 1
|
||||
}
|
||||
entry (t: mut Table) {
|
||||
push(t.rows, new Row)
|
||||
bump(t)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue