Lit.Core: prevent users from defining type named "U64"

This commit is contained in:
Kelvin Santos 2021-09-23 15:14:35 -03:00
parent a88817c5c9
commit 13a2e5e6ba
3 changed files with 15 additions and 3 deletions

View File

@ -447,7 +447,11 @@ Lit.Core.World.run.statement(
data:
log("- new_type: " | type.name)
case world{type.name} as got_type {
none: some(world{type.name} <- Lit.Core.Entry.type(type))
none:
if not(type.name =? "U64") then
some(world{type.name} <- Lit.Core.Entry.type(type))
else
log("error: cannot redefine built-in type named 'U64'") none
} default log("error: type redefinition: " | type.name) none
}
bond:
@ -623,7 +627,13 @@ Lit.Core.World.run.terms(
// -----
Lit.Core: _
let world = {}
let code = Lit.Lang.Type|Lit.Lang.Cmp|Lit.Lang.Nat|Lit.Lang.Bits|Lit.Lang.BitsMap|`
let code =
Lit.Lang.Type
| Lit.Lang.Cmp
| Lit.Lang.Nat
| Lit.Lang.Bits
| Lit.Lang.BitsMap
|`
type BoolList {
nil
cons{

View File

@ -156,7 +156,7 @@ BitsMap.transct_2(state: BitsMap, from: Bits, to: Bits, sum: Bits): BitsMap
//[[dando um set]]
//alterar o valor do receiver (adicionar o sum )
[[dando um set ]]
// [[dando um set ]]
// call
// state
// false:

View File

@ -67,4 +67,6 @@ type BitsBitsBits {
snd: Bits
trd: Bits
}
}
`