fez-lisp 1.5.128 → 1.5.129

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/check.js +11 -1
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "fez-lisp",
3
3
  "description": "Lisp interpreted & compiled to JavaScript",
4
4
  "author": "AT290690",
5
- "version": "1.5.128",
5
+ "version": "1.5.129",
6
6
  "type": "module",
7
7
  "main": "index.js",
8
8
  "keywords": [
package/src/check.js CHANGED
@@ -308,6 +308,7 @@ const IsPredicate = (leaf) =>
308
308
  (PREDICATES_OUTPUT_SET.has(leaf[VALUE]) ||
309
309
  getSuffix(leaf[VALUE]) === PREDICATE_SUFFIX))
310
310
 
311
+ // THese should also check if sub type is Uknown array and pass as ok
311
312
  const notABooleanType = (a, b) => {
312
313
  return (
313
314
  hasSubType(a) &&
@@ -1054,10 +1055,12 @@ export const typeCheck = (ast) => {
1054
1055
  // const PRED_TYPE = args[i][STATS][TYPE_PROP][1]
1055
1056
  const MAIN_TYPE = getType(args[i][STATS])
1056
1057
  if (MAIN_TYPE === ANY) continue
1058
+ // TODO - try to merge special and non special
1057
1059
  if (first[TYPE] === APPLY && isSpecial) {
1058
1060
  if (!isResLeaf) {
1059
1061
  const name = rest[i][0][VALUE]
1060
1062
  if (!env[name]) continue
1063
+ // there is a problem here with cond pr when passed as an argument
1061
1064
  if (name === KEYWORDS.IF) {
1062
1065
  const concequent = [...rest]
1063
1066
  const alternative = [...rest]
@@ -1073,6 +1076,7 @@ export const typeCheck = (ast) => {
1073
1076
  check(exp, env, scope)
1074
1077
  )
1075
1078
  } else if (
1079
+ !isUnknownType(args[i][STATS]) &&
1076
1080
  !isUnknownReturn(env[name][STATS]) &&
1077
1081
  !compareTypeWithReturn(args[i][STATS], env[name][STATS])
1078
1082
  )
@@ -1086,6 +1090,7 @@ export const typeCheck = (ast) => {
1086
1090
  )}) (${stringifyArgs(exp)}) (check #1)`
1087
1091
  )
1088
1092
  else if (
1093
+ !isUnknownReturn(args[i][STATS]) &&
1089
1094
  !isUnknownReturn(env[name][STATS]) &&
1090
1095
  notABooleanReturn(args[i][STATS], env[name][STATS])
1091
1096
  )
@@ -1121,6 +1126,7 @@ export const typeCheck = (ast) => {
1121
1126
  const name = rest[i][VALUE]
1122
1127
  if (!env[name]) continue
1123
1128
  if (
1129
+ !isUnknownType(args[i][STATS]) &&
1124
1130
  !isUnknownType(env[name][STATS]) &&
1125
1131
  !compareTypes(args[i][STATS], env[name][STATS])
1126
1132
  )
@@ -1134,6 +1140,7 @@ export const typeCheck = (ast) => {
1134
1140
  )}) (${stringifyArgs(exp)}) (check #3)`
1135
1141
  )
1136
1142
  else if (
1143
+ !isUnknownType(args[i][STATS]) &&
1137
1144
  !isUnknownType(env[name][STATS]) &&
1138
1145
  notABooleanType(args[i][STATS], env[name][STATS])
1139
1146
  )
@@ -1164,7 +1171,10 @@ export const typeCheck = (ast) => {
1164
1171
  }
1165
1172
  break
1166
1173
  case ATOM: {
1167
- if (rest[i][TYPE] !== args[i][STATS][TYPE_PROP][0])
1174
+ if (
1175
+ !isUnknownType(args[i][STATS]) &&
1176
+ rest[i][TYPE] !== args[i][STATS][TYPE_PROP][0]
1177
+ )
1168
1178
  throw new TypeError(
1169
1179
  `Incorrect type of argument (${i}) for special form (${
1170
1180
  first[VALUE]