fez-lisp 1.6.40 → 1.6.41

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 +24 -3
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.41",
6
6
  "type": "module",
7
7
  "main": "index.js",
8
8
  "keywords": [
package/src/check.js CHANGED
@@ -1231,7 +1231,24 @@ export const typeCheck = (
1231
1231
  )
1232
1232
  const expected = env[name]
1233
1233
  const actual = env[lambdaName]
1234
- once(actual[STATS], exp, stack, () => {
1234
+ const checkReturns = () => {
1235
+ if (
1236
+ !isUnknownReturn(actual[STATS]) &&
1237
+ (!equalReturns(expected[STATS], actual[STATS]) ||
1238
+ !equalSubReturns(expected[STATS], actual[STATS]))
1239
+ )
1240
+ throw new TypeError(
1241
+ `Incorrect return type for (${
1242
+ expected[STATS][SIGNATURE]
1243
+ }) Expected (${formatSubType(
1244
+ getReturns(expected[STATS])
1245
+ )}) but got (${formatSubType(
1246
+ getReturns(actual[STATS])
1247
+ )}) (${stringifyArgs(exp)}) (check #999)`
1248
+ )
1249
+ else retry(actual[STATS], exp, stack, checkReturns)
1250
+ }
1251
+ const checkArgs = () => {
1235
1252
  if (
1236
1253
  !isUnknownReturn(actual[STATS]) &&
1237
1254
  (!equalReturns(expected[STATS], actual[STATS]) ||
@@ -1255,7 +1272,7 @@ export const typeCheck = (
1255
1272
  !equalSubTypes(argE[STATS], argA[STATS]))
1256
1273
  )
1257
1274
  throw new TypeError(
1258
- `Incorrect return type for argument (${
1275
+ `Incorrect type for argument (${
1259
1276
  argA[STATS][SIGNATURE]
1260
1277
  }) The (${KEYWORDS.ANONYMOUS_FUNCTION}) argument of (${
1261
1278
  expected[STATS][SIGNATURE]
@@ -1265,8 +1282,12 @@ export const typeCheck = (
1265
1282
  getTypes(argA[STATS])
1266
1283
  )}) (${stringifyArgs(exp)}) (check #1000)`
1267
1284
  )
1285
+ else retry(actual[STATS], exp, stack, checkArgs)
1268
1286
  }
1269
-
1287
+ }
1288
+ once(actual[STATS], exp, stack, () => {
1289
+ checkReturns()
1290
+ checkArgs()
1270
1291
  Types.delete(`; ${rootScopeIndex} ${lambdaName}`)
1271
1292
  })
1272
1293
  }