MCPcopy Create free account
hub / github.com/arktypeio/arktype / isSubsumed

Function isSubsumed

ark/schema/node.ts:1811–1831  ·  view source on GitHub ↗
(
	branch: BaseRoot,
	other: BaseRoot,
	s: SimulationState
)

Source from the content-addressed store, hash-verified

1809let isSubsuming = false
1810
1811const isSubsumed = (
1812 branch: BaseRoot,
1813 other: BaseRoot,
1814 s: SimulationState
1815): boolean => {
1816 if (branch.is("morph") && other.is("morph") && !branch.sameMorphs(other))
1817 return false
1818 let intersection: BaseRoot | Disjoint
1819 isSubsuming = true
1820 try {
1821 // relating them reads resolutions directly, so the intersection isn't finalized
1822 intersection = branch.rawIntersect(other)
1823 } finally {
1824 isSubsuming = false
1825 }
1826 return (
1827 !(intersection instanceof Disjoint) &&
1828 isSimulated(branch, intersection, s) &&
1829 isSimulated(intersection, branch, s)
1830 )
1831}
1832
1833const isWithin = (l: BaseRoot, r: BaseRoot, s: SimulationState): boolean =>
1834 l.branches.every(

Callers 2

isSimulatedFunction · 0.85
isWithinFunction · 0.85

Calls 3

isSimulatedFunction · 0.85
isMethod · 0.80
sameMorphsMethod · 0.80

Tested by

no test coverage detected