Merge pull request #1027 from urbit/hasnt

+has:in typecheck hack
This commit is contained in:
Ted Blackman 2019-01-29 17:16:24 -08:00 committed by GitHub
commit 101d50c8a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 13 deletions

View File

@ -498,7 +498,7 @@
~/ %hall-action-create ~/ %hall-action-create
|= {nom/name des/cord typ/security} |= {nom/name des/cord typ/security}
^+ ..ta-action ^+ ..ta-action
?. (~(has in stories) nom) ?. (~(has by stories) nom)
%^ impact nom %new %^ impact nom %new
:* [[[our.bol nom] ~] ~ ~] :* [[[our.bol nom] ~] ~ ~]
des des
@ -516,7 +516,7 @@
:: ::
~/ %hall-action-design ~/ %hall-action-design
|= {nom/name cof/config} |= {nom/name cof/config}
?. (~(has in stories) nom) ?. (~(has by stories) nom)
(impact nom %new cof) (impact nom %new cof)
(ta-evil (crip "{(trip nom)}: already exists")) (ta-evil (crip "{(trip nom)}: already exists"))
:: ::
@ -2654,15 +2654,16 @@
== ==
:: ::
?: =(wat ~) & ?: =(wat ~) &
%- ~(has in wat) ?+ -.det |
?+ -.det %hasnot $gram (~(has in wat) %grams)
$gram %grams $new (~(has in wat) %config-l)
$new %config-l $remove (~(has in wat) %config-l)
$remove %config-l
$config ?: =(cir.det [our.bol nom]) $config ?: =(cir.det [our.bol nom])
%config-l %config-r (~(has in wat) %config-l)
(~(has in wat) %config-r)
$status ?: =(cir.det [our.bol nom]) $status ?: =(cir.det [our.bol nom])
%group-l %group-r (~(has in wat) %group-l)
(~(has in wat) %group-r)
== ==
== ==
:: ::

View File

@ -1335,10 +1335,26 @@
?~ b ?~ b
a a
$(b t.b, a (put i.b)) $(b t.b, a (put i.b))
:: +has: does :b exist in :a?
:: ::
++ has :: b exists in a check ++ has
~/ %has ~/ %has
|* b/* |* b=*
^- ?
:: wrap extracted item type in a unit because bunting fails
::
:: If we used the real item type of _?^(a n.a !!) as the sample type,
:: then hoon would bunt it to create the default sample for the gate.
::
:: However, bunting that expression fails if :a is ~. If we wrap it
:: in a unit, the bunted unit doesn't include the bunted item type.
::
:: This way we can ensure type safety of :b without needing to perform
:: this failing bunt. It's a hack.
::
%. [~ b]
|= b=(unit _?>(?=(^ a) n.a))
=> .(b ?>(?=(^ b) u.b))
|- ^- ? |- ^- ?
?~ a ?~ a
| |
@ -12114,7 +12130,7 @@
|= [acc=_map [ty=type k=xkey]] |= [acc=_map [ty=type k=xkey]]
=/ dest (~(get by refs.tbl) k) =/ dest (~(get by refs.tbl) k)
?^ dest (~(put by acc) ty u.dest) ?^ dest (~(put by acc) ty u.dest)
?. (~(has in live.tbl)) acc ?. (~(has in live.tbl) k) acc
(~(put in acc) ty k) (~(put in acc) ty k)
:: ::
:: Rebuild the `xrays` table. :: Rebuild the `xrays` table.

View File

@ -5932,7 +5932,7 @@
%+ welp tam %+ welp tam
=- ?~(att rez [' ' (attr att rez)]) =- ?~(att rez [' ' (attr att rez)])
^- rez/tape ^- rez/tape
?: &(?=(~ c.mex) |(cot (clot man))) ?: &(?=(~ c.mex) |(cot ?^(man | (clot man))))
[' ' '/' '>' rez] [' ' '/' '>' rez]
:- '>' :- '>'
(many c.mex :(weld "</" tam ">" rez)) (many c.mex :(weld "</" tam ">" rez))