fez-lisp 1.5.82 → 1.5.83
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/lib/baked/std.js +1 -1
- package/package.json +1 -1
- package/src/check.js +21 -5
package/package.json
CHANGED
package/src/check.js
CHANGED
@@ -680,19 +680,35 @@ export const typeCheck = (ast) => {
|
|
680
680
|
const alternative = isLeaf(re[1])
|
681
681
|
? copy[re[1][VALUE]]
|
682
682
|
: copy[re[1][0][VALUE]]
|
683
|
+
|
683
684
|
// todo check if condition matches alternative
|
685
|
+
// TODO make this more simple - it's so many different things just because types are functions or not
|
686
|
+
// WHY not consiter making return types for everything
|
684
687
|
if (
|
685
688
|
concequent &&
|
686
|
-
concequent[STATS][
|
689
|
+
concequent[STATS][TYPE_PROP][0] !== UNKNOWN
|
687
690
|
) {
|
688
|
-
|
691
|
+
if (concequent[STATS][TYPE_PROP][0] === APPLY)
|
692
|
+
ref[STATS][RETURNS] = concequent[STATS][RETURNS]
|
693
|
+
else
|
694
|
+
ref[STATS][RETURNS] =
|
695
|
+
concequent[STATS][TYPE_PROP]
|
689
696
|
} else if (
|
690
697
|
alternative &&
|
691
|
-
alternative[STATS][
|
698
|
+
alternative[STATS][TYPE_PROP][0] !== UNKNOWN
|
692
699
|
) {
|
693
|
-
|
700
|
+
if (alternative[STATS][TYPE_PROP][0] === APPLY)
|
701
|
+
ref[STATS][RETURNS] =
|
702
|
+
alternative[STATS][RETURNS]
|
703
|
+
else
|
704
|
+
ref[STATS][RETURNS] =
|
705
|
+
alternative[STATS][TYPE_PROP]
|
694
706
|
} else if (concequent) {
|
695
|
-
|
707
|
+
if (concequent[STATS][TYPE_PROP][0] === APPLY)
|
708
|
+
ref[STATS][RETURNS] = concequent[STATS][RETURNS]
|
709
|
+
else
|
710
|
+
ref[STATS][RETURNS] =
|
711
|
+
concequent[STATS][TYPE_PROP]
|
696
712
|
}
|
697
713
|
}
|
698
714
|
|