fez-lisp 1.6.40 → 1.6.42

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 +12 -4
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.6.40",
5
+ "version": "1.6.42",
6
6
  "type": "module",
7
7
  "main": "index.js",
8
8
  "keywords": [
package/src/check.js CHANGED
@@ -1116,7 +1116,8 @@ export const typeCheck = (
1116
1116
  if (
1117
1117
  !isUnknownType(actual[STATS]) &&
1118
1118
  !isUnknownType(expected[STATS]) &&
1119
- !equalTypes(actual[STATS], expected[STATS])
1119
+ (!equalTypes(actual[STATS], expected[STATS]) ||
1120
+ !equalSubTypes(actual[STATS], expected[STATS]))
1120
1121
  )
1121
1122
  throw new TypeError(
1122
1123
  `Incorrect type for (${KEYWORDS.ANONYMOUS_FUNCTION}) (${
@@ -1231,7 +1232,7 @@ export const typeCheck = (
1231
1232
  )
1232
1233
  const expected = env[name]
1233
1234
  const actual = env[lambdaName]
1234
- once(actual[STATS], exp, stack, () => {
1235
+ const checkReturns = () => {
1235
1236
  if (
1236
1237
  !isUnknownReturn(actual[STATS]) &&
1237
1238
  (!equalReturns(expected[STATS], actual[STATS]) ||
@@ -1246,6 +1247,9 @@ export const typeCheck = (
1246
1247
  getReturns(actual[STATS])
1247
1248
  )}) (${stringifyArgs(exp)}) (check #999)`
1248
1249
  )
1250
+ else retry(actual[STATS], exp, stack, checkReturns)
1251
+ }
1252
+ const checkArgs = () => {
1249
1253
  for (let i = 0; i < expected[STATS][ARGUMENTS].length; ++i) {
1250
1254
  const argE = expected[STATS][ARGUMENTS][i]
1251
1255
  const argA = actual[STATS][ARGUMENTS][i]
@@ -1255,7 +1259,7 @@ export const typeCheck = (
1255
1259
  !equalSubTypes(argE[STATS], argA[STATS]))
1256
1260
  )
1257
1261
  throw new TypeError(
1258
- `Incorrect return type for argument (${
1262
+ `Incorrect type for argument (${
1259
1263
  argA[STATS][SIGNATURE]
1260
1264
  }) The (${KEYWORDS.ANONYMOUS_FUNCTION}) argument of (${
1261
1265
  expected[STATS][SIGNATURE]
@@ -1265,8 +1269,12 @@ export const typeCheck = (
1265
1269
  getTypes(argA[STATS])
1266
1270
  )}) (${stringifyArgs(exp)}) (check #1000)`
1267
1271
  )
1272
+ else retry(actual[STATS], exp, stack, checkArgs)
1268
1273
  }
1269
-
1274
+ }
1275
+ once(actual[STATS], exp, stack, () => {
1276
+ checkReturns()
1277
+ checkArgs()
1270
1278
  Types.delete(`; ${rootScopeIndex} ${lambdaName}`)
1271
1279
  })
1272
1280
  }