fez-lisp 1.6.65 → 1.6.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/check.js +28 -2
package/package.json
CHANGED
package/src/check.js
CHANGED
@@ -612,11 +612,24 @@ const resolveCondition = ({ rem, name, env, exp, prop, stack, check }) => {
|
|
612
612
|
break
|
613
613
|
}
|
614
614
|
}
|
615
|
-
const resolveGetter = ({ rem, prop, name, env }) => {
|
615
|
+
const resolveGetter = ({ rem, prop, name, env, caller, exp }) => {
|
616
616
|
const array = isLeaf(rem[1]) ? rem[1] : rem[1][0]
|
617
617
|
if (!env[array[VALUE]] || !env[name]) return true
|
618
618
|
switch (array[TYPE]) {
|
619
619
|
case APPLY:
|
620
|
+
if (
|
621
|
+
getReturn(env[array[VALUE]][STATS]) === UNKNOWN ||
|
622
|
+
getReturn(env[array[VALUE]][STATS]) === ANY
|
623
|
+
)
|
624
|
+
return true
|
625
|
+
if (getReturn(env[array[VALUE]][STATS]) !== COLLECTION)
|
626
|
+
throw new TypeError(
|
627
|
+
`Incorrect type of argument (${0}) for (${caller}). Expected (${formatSubType(
|
628
|
+
getTypes(env[caller][STATS][ARGUMENTS][0][STATS])
|
629
|
+
)}) but got (${formatSubType(
|
630
|
+
getReturns(env[array[VALUE]][STATS])
|
631
|
+
)}) (${stringifyArgs(exp)}) (check #1001)`
|
632
|
+
)
|
620
633
|
if (hasSubReturn(env[array[VALUE]][STATS])) {
|
621
634
|
const rightSub = getSubReturn(env[array[VALUE]][STATS])
|
622
635
|
const isAtom = rightSub.has(NUMBER) || rightSub.has(BOOLEAN)
|
@@ -634,6 +647,19 @@ const resolveGetter = ({ rem, prop, name, env }) => {
|
|
634
647
|
break
|
635
648
|
case WORD:
|
636
649
|
{
|
650
|
+
if (
|
651
|
+
getType(env[array[VALUE]][STATS]) === UNKNOWN ||
|
652
|
+
getType(env[array[VALUE]][STATS]) === ANY
|
653
|
+
)
|
654
|
+
return true
|
655
|
+
if (getType(env[array[VALUE]][STATS]) !== COLLECTION)
|
656
|
+
throw new TypeError(
|
657
|
+
`Incorrect type of argument (${0}) for (${caller}). Expected (${formatSubType(
|
658
|
+
getTypes(env[caller][STATS][ARGUMENTS][0][STATS])
|
659
|
+
)}) but got (${formatSubType(
|
660
|
+
getType(env[array[VALUE]][STATS])
|
661
|
+
)}) (${stringifyArgs(exp)}) (check #1002)`
|
662
|
+
)
|
637
663
|
if (hasSubType(env[array[VALUE]][STATS])) {
|
638
664
|
const rightSub = getSubType(env[array[VALUE]][STATS])
|
639
665
|
const isAtom =
|
@@ -870,7 +896,7 @@ const resolveReturnType = ({
|
|
870
896
|
default:
|
871
897
|
{
|
872
898
|
if (GET_ARRAY_INFERENCE_SET.has(returns[VALUE]))
|
873
|
-
resolveGetter({ rem, prop, name, env })
|
899
|
+
resolveGetter({ rem, prop, name, env, caller: returns[VALUE], exp })
|
874
900
|
checkPredicateNameDeep(name, exp, exp.slice(1), returns)
|
875
901
|
// TODO: DRY
|
876
902
|
const index = env[name][STATS][ARGUMENTS]
|