mirror of
https://github.com/Kindelia/Kind2.git
synced 2024-09-11 07:15:45 +03:00
fixing Lit.Core.Term.match
construction on parser
This commit is contained in:
parent
e048edd6f8
commit
956ee91bea
@ -164,8 +164,6 @@ Lit.Core.World.get_type(name: String, world: Lit.Core.World): Maybe<Lit.Core.Typ
|
||||
} default none
|
||||
} default none
|
||||
|
||||
// TODO prevent users from defining type named "U64"
|
||||
|
||||
Lit.Core.World.get_func(name: String, world: Lit.Core.World): Maybe<Lit.Core.Bond>
|
||||
case world{name} as entry {
|
||||
some: case entry.value {
|
||||
@ -200,10 +198,10 @@ Lit.Core.World.check.term(
|
||||
log("- chk " | Lit.Lang.show.term(term, world) | " : " | Lit.Lang.show.type.short(type)) // DEBUG
|
||||
log("- ctx " | String.join(", ", List.map!!((a) a@fst|":"|Lit.Lang.show.type.short(a@snd), Map.to_list!(context)))) // DEBUG
|
||||
log("") // DEBUG
|
||||
case term {
|
||||
let result = case term {
|
||||
var:
|
||||
let var_type = context{term.name} abort false
|
||||
log("-- var " | Lit.Lang.show.type.short(var_type) | " " | Lit.Lang.show.type.short(type)) // DEBUG
|
||||
log("-- var " | term.name | " " | Lit.Lang.show.type.short(var_type) | " " | Lit.Lang.show.type.short(type)) // DEBUG
|
||||
Lit.Core.Type.equal(var_type, type)
|
||||
create:
|
||||
log("-- create") // DEBUG
|
||||
@ -268,6 +266,8 @@ Lit.Core.World.check.term(
|
||||
let val1 = Lit.Core.World.check.term(term.val1, Lit.Core.Type.word, context, world, caller)
|
||||
val0 && val1
|
||||
}
|
||||
log("\n")
|
||||
result
|
||||
|
||||
Lit.Core.World.check.many(
|
||||
terms: List<Lit.Core.Term>
|
||||
|
@ -457,7 +457,7 @@ Lit.Lang.parser.term.match(world: Lit.Core.World): Parser<Lit.Core.Term>
|
||||
Lit.Lang.parser.text("{")
|
||||
get cses = Lit.Lang.parser.term.match.cses(type.constructors, name, world)
|
||||
Lit.Lang.parser.text("}")
|
||||
return Lit.Core.Term.match(type_name, name, expr, cses)
|
||||
return Lit.Core.Term.match(name, type_name, expr, cses)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
Lit.Lang.Bits: String
|
||||
`
|
||||
|
||||
Bits.tail(a: Bits): Pair.Bits
|
||||
Bits.tail(a: Bits): Bits
|
||||
case a : Bits {
|
||||
e: Bits/e
|
||||
o: a.pred
|
||||
|
Loading…
Reference in New Issue
Block a user