fez-lisp 1.5.103 → 1.5.104

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 +18 -6
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.103",
5
+ "version": "1.5.104",
6
6
  "type": "module",
7
7
  "main": "index.js",
8
8
  "keywords": [
package/src/check.js CHANGED
@@ -849,7 +849,7 @@ export const typeCheck = (ast, error = true) => {
849
849
  getType(args[i][STATS]) !== ATOM
850
850
  ) {
851
851
  throw new TypeError(
852
- `Incorrect type of arguments ${i} for (${
852
+ `Incorrect type of argument (${i}) for (${
853
853
  first[VALUE]
854
854
  }). Expected (${toTypeNames(
855
855
  getType(args[i][STATS])
@@ -863,8 +863,19 @@ export const typeCheck = (ast, error = true) => {
863
863
  !isUnknownType(env[rest[i][VALUE]][STATS]) &&
864
864
  env[rest[i][VALUE]][STATS][ARG_COUNT] !== VARIADIC
865
865
  ) {
866
+ if (getType(args[i][STATS]) !== APPLY)
867
+ // TODO this should really happen in 10 or 16
868
+ throw new TypeError(
869
+ `Incorrect type for argument of (${
870
+ first[VALUE]
871
+ }) at position (${i}). Expected (${
872
+ STATIC_TYPES.ABSTRACTION
873
+ }) but got (${toTypeNames(
874
+ getType(args[i][STATS])
875
+ )}) (${stringifyArgs(exp)}) (check #111)`
876
+ )
866
877
  // Handles words that are Lambdas
867
- if (
878
+ else if (
868
879
  env[rest[i][VALUE]][STATS][ARG_COUNT] !==
869
880
  args[i][STATS][ARG_COUNT]
870
881
  ) {
@@ -937,6 +948,7 @@ export const typeCheck = (ast, error = true) => {
937
948
  }
938
949
  }
939
950
  }
951
+
940
952
  if (
941
953
  T === COLLECTION &&
942
954
  env[rest[i][VALUE]] &&
@@ -945,7 +957,7 @@ export const typeCheck = (ast, error = true) => {
945
957
  !compareTypes(env[rest[i][VALUE]][STATS], args[i][STATS])
946
958
  ) {
947
959
  throw new TypeError(
948
- `Incorrect type of arguments ${i} for (${
960
+ `Incorrect type of argument (${i}) for (${
949
961
  first[VALUE]
950
962
  }). Expected (${toTypeNames(
951
963
  getType(args[i][STATS])
@@ -953,9 +965,9 @@ export const typeCheck = (ast, error = true) => {
953
965
  exp
954
966
  )}) (check #30)`
955
967
  )
956
- } else if (isUnknownType(args[i][STATS]))
968
+ } else if (isUnknownType(args[i][STATS])) {
957
969
  retry(args[i][STATS], stack, () => check(exp, env, scope))
958
- else if (
970
+ } else if (
959
971
  env[rest[i][VALUE]] &&
960
972
  !isUnknownType(args[i][STATS]) &&
961
973
  isUnknownType(env[rest[i][VALUE]][STATS]) &&
@@ -975,7 +987,7 @@ export const typeCheck = (ast, error = true) => {
975
987
  if (!isUnknownType(expected) && !isUnknownReturn(actual))
976
988
  if (!compareTypeWithReturn(expected, actual))
977
989
  throw new TypeError(
978
- `Incorrect type of arguments ${i} for (${
990
+ `Incorrect type of argument (${i}) for (${
979
991
  first[VALUE]
980
992
  }). Expected (${toTypeNames(
981
993
  getType(expected)