diff options
| author | Stefan Monnier | 2022-09-13 09:36:21 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2022-09-13 09:36:21 -0400 |
| commit | 93466e85d138b7e0765b97f83d442202121b4298 (patch) | |
| tree | f38f96129845d4e2497f717c4c6c7d2b1e80c98c /test/src/comp-tests.el | |
| parent | dfbe745ed9ba89e516ef89955f2ca88be04d1d72 (diff) | |
| download | emacs-93466e85d138b7e0765b97f83d442202121b4298.tar.gz emacs-93466e85d138b7e0765b97f83d442202121b4298.zip | |
comp-tests.el: Enable compilation again
Rather than disable byte-compilation to circumvent bug#51104,
change the ELisp code so that `most-positive/negative-fixnum` does
not end up hardcoded in the `.elc` file.
* test/src/comp-tests.el (comp-tests-define-type-spec-test):
Don't quote the type expressions.
(comp-tests-type-spec-tests): Quote them here instead.
Diffstat (limited to 'test/src/comp-tests.el')
| -rw-r--r-- | test/src/comp-tests.el | 161 |
1 files changed, 76 insertions, 85 deletions
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index b85d365b0b0..a400a1a50a1 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el | |||
| @@ -860,21 +860,21 @@ Return a list of results." | |||
| 860 | 860 | ||
| 861 | (cl-eval-when (compile eval load) | 861 | (cl-eval-when (compile eval load) |
| 862 | (defconst comp-tests-type-spec-tests | 862 | (defconst comp-tests-type-spec-tests |
| 863 | `( | 863 | '( |
| 864 | ;; 1 | 864 | ;; 1 |
| 865 | ((defun comp-tests-ret-type-spec-f (x) | 865 | ((defun comp-tests-ret-type-spec-f (x) |
| 866 | x) | 866 | x) |
| 867 | t) | 867 | 't) |
| 868 | 868 | ||
| 869 | ;; 2 | 869 | ;; 2 |
| 870 | ((defun comp-tests-ret-type-spec-f () | 870 | ((defun comp-tests-ret-type-spec-f () |
| 871 | 1) | 871 | 1) |
| 872 | (integer 1 1)) | 872 | '(integer 1 1)) |
| 873 | 873 | ||
| 874 | ;; 3 | 874 | ;; 3 |
| 875 | ((defun comp-tests-ret-type-spec-f (x) | 875 | ((defun comp-tests-ret-type-spec-f (x) |
| 876 | (if x 1 3)) | 876 | (if x 1 3)) |
| 877 | (or (integer 1 1) (integer 3 3))) | 877 | '(or (integer 1 1) (integer 3 3))) |
| 878 | 878 | ||
| 879 | ;; 4 | 879 | ;; 4 |
| 880 | ((defun comp-tests-ret-type-spec-f (x) | 880 | ((defun comp-tests-ret-type-spec-f (x) |
| @@ -883,7 +883,7 @@ Return a list of results." | |||
| 883 | (setf y 1) | 883 | (setf y 1) |
| 884 | (setf y 2)) | 884 | (setf y 2)) |
| 885 | y)) | 885 | y)) |
| 886 | (integer 1 2)) | 886 | '(integer 1 2)) |
| 887 | 887 | ||
| 888 | ;; 5 | 888 | ;; 5 |
| 889 | ((defun comp-tests-ret-type-spec-f (x) | 889 | ((defun comp-tests-ret-type-spec-f (x) |
| @@ -892,73 +892,73 @@ Return a list of results." | |||
| 892 | (setf y 1) | 892 | (setf y 1) |
| 893 | (setf y 3)) | 893 | (setf y 3)) |
| 894 | y)) | 894 | y)) |
| 895 | (or (integer 1 1) (integer 3 3))) | 895 | '(or (integer 1 1) (integer 3 3))) |
| 896 | 896 | ||
| 897 | ;; 6 | 897 | ;; 6 |
| 898 | ((defun comp-tests-ret-type-spec-f (x) | 898 | ((defun comp-tests-ret-type-spec-f (x) |
| 899 | (if x | 899 | (if x |
| 900 | (list x) | 900 | (list x) |
| 901 | 3)) | 901 | 3)) |
| 902 | (or cons (integer 3 3))) | 902 | '(or cons (integer 3 3))) |
| 903 | 903 | ||
| 904 | ;; 7 | 904 | ;; 7 |
| 905 | ((defun comp-tests-ret-type-spec-f (x) | 905 | ((defun comp-tests-ret-type-spec-f (x) |
| 906 | (if x | 906 | (if x |
| 907 | 'foo | 907 | 'foo |
| 908 | 3)) | 908 | 3)) |
| 909 | (or (member foo) (integer 3 3))) | 909 | '(or (member foo) (integer 3 3))) |
| 910 | 910 | ||
| 911 | ;; 8 | 911 | ;; 8 |
| 912 | ((defun comp-tests-ret-type-spec-f (x) | 912 | ((defun comp-tests-ret-type-spec-f (x) |
| 913 | (if (eq x 3) | 913 | (if (eq x 3) |
| 914 | x | 914 | x |
| 915 | 'foo)) | 915 | 'foo)) |
| 916 | (or (member foo) (integer 3 3))) | 916 | '(or (member foo) (integer 3 3))) |
| 917 | 917 | ||
| 918 | ;; 9 | 918 | ;; 9 |
| 919 | ((defun comp-tests-ret-type-spec-f (x) | 919 | ((defun comp-tests-ret-type-spec-f (x) |
| 920 | (if (eq 3 x) | 920 | (if (eq 3 x) |
| 921 | x | 921 | x |
| 922 | 'foo)) | 922 | 'foo)) |
| 923 | (or (member foo) (integer 3 3))) | 923 | '(or (member foo) (integer 3 3))) |
| 924 | 924 | ||
| 925 | ;; 10 | 925 | ;; 10 |
| 926 | ((defun comp-tests-ret-type-spec-f (x) | 926 | ((defun comp-tests-ret-type-spec-f (x) |
| 927 | (if (eql x 3) | 927 | (if (eql x 3) |
| 928 | x | 928 | x |
| 929 | 'foo)) | 929 | 'foo)) |
| 930 | (or (member foo) (integer 3 3))) | 930 | '(or (member foo) (integer 3 3))) |
| 931 | 931 | ||
| 932 | ;; 11 | 932 | ;; 11 |
| 933 | ((defun comp-tests-ret-type-spec-f (x) | 933 | ((defun comp-tests-ret-type-spec-f (x) |
| 934 | (if (eql 3 x) | 934 | (if (eql 3 x) |
| 935 | x | 935 | x |
| 936 | 'foo)) | 936 | 'foo)) |
| 937 | (or (member foo) (integer 3 3))) | 937 | '(or (member foo) (integer 3 3))) |
| 938 | 938 | ||
| 939 | ;; 12 | 939 | ;; 12 |
| 940 | ((defun comp-tests-ret-type-spec-f (x) | 940 | ((defun comp-tests-ret-type-spec-f (x) |
| 941 | (if (eql x 3) | 941 | (if (eql x 3) |
| 942 | 'foo | 942 | 'foo |
| 943 | x)) | 943 | x)) |
| 944 | (not (integer 3 3))) | 944 | '(not (integer 3 3))) |
| 945 | 945 | ||
| 946 | ;; 13 | 946 | ;; 13 |
| 947 | ((defun comp-tests-ret-type-spec-f (x y) | 947 | ((defun comp-tests-ret-type-spec-f (x y) |
| 948 | (if (= x y) | 948 | (if (= x y) |
| 949 | x | 949 | x |
| 950 | 'foo)) | 950 | 'foo)) |
| 951 | (or (member foo) marker number)) | 951 | '(or (member foo) marker number)) |
| 952 | 952 | ||
| 953 | ;; 14 | 953 | ;; 14 |
| 954 | ((defun comp-tests-ret-type-spec-f (x) | 954 | ((defun comp-tests-ret-type-spec-f (x) |
| 955 | (comp-hint-fixnum x)) | 955 | (comp-hint-fixnum x)) |
| 956 | (integer ,most-negative-fixnum ,most-positive-fixnum)) | 956 | `(integer ,most-negative-fixnum ,most-positive-fixnum)) |
| 957 | 957 | ||
| 958 | ;; 15 | 958 | ;; 15 |
| 959 | ((defun comp-tests-ret-type-spec-f (x) | 959 | ((defun comp-tests-ret-type-spec-f (x) |
| 960 | (comp-hint-cons x)) | 960 | (comp-hint-cons x)) |
| 961 | cons) | 961 | 'cons) |
| 962 | 962 | ||
| 963 | ;; 16 | 963 | ;; 16 |
| 964 | ((defun comp-tests-ret-type-spec-f (x) | 964 | ((defun comp-tests-ret-type-spec-f (x) |
| @@ -966,7 +966,7 @@ Return a list of results." | |||
| 966 | (when x | 966 | (when x |
| 967 | (setf y 4)) | 967 | (setf y 4)) |
| 968 | y)) | 968 | y)) |
| 969 | (or null (integer 4 4))) | 969 | '(or null (integer 4 4))) |
| 970 | 970 | ||
| 971 | ;; 17 | 971 | ;; 17 |
| 972 | ((defun comp-tests-ret-type-spec-f () | 972 | ((defun comp-tests-ret-type-spec-f () |
| @@ -974,7 +974,7 @@ Return a list of results." | |||
| 974 | (y 3)) | 974 | (y 3)) |
| 975 | (setf x y) | 975 | (setf x y) |
| 976 | y)) | 976 | y)) |
| 977 | (integer 3 3)) | 977 | '(integer 3 3)) |
| 978 | 978 | ||
| 979 | ;; 18 | 979 | ;; 18 |
| 980 | ((defun comp-tests-ret-type-spec-f (x) | 980 | ((defun comp-tests-ret-type-spec-f (x) |
| @@ -982,120 +982,120 @@ Return a list of results." | |||
| 982 | (when x | 982 | (when x |
| 983 | (setf y x)) | 983 | (setf y x)) |
| 984 | y)) | 984 | y)) |
| 985 | t) | 985 | 't) |
| 986 | 986 | ||
| 987 | ;; 19 | 987 | ;; 19 |
| 988 | ((defun comp-tests-ret-type-spec-f (x y) | 988 | ((defun comp-tests-ret-type-spec-f (x y) |
| 989 | (eq x y)) | 989 | (eq x y)) |
| 990 | boolean) | 990 | 'boolean) |
| 991 | 991 | ||
| 992 | ;; 20 | 992 | ;; 20 |
| 993 | ((defun comp-tests-ret-type-spec-f (x) | 993 | ((defun comp-tests-ret-type-spec-f (x) |
| 994 | (when x | 994 | (when x |
| 995 | 'foo)) | 995 | 'foo)) |
| 996 | (or (member foo) null)) | 996 | '(or (member foo) null)) |
| 997 | 997 | ||
| 998 | ;; 21 | 998 | ;; 21 |
| 999 | ((defun comp-tests-ret-type-spec-f (x) | 999 | ((defun comp-tests-ret-type-spec-f (x) |
| 1000 | (unless x | 1000 | (unless x |
| 1001 | 'foo)) | 1001 | 'foo)) |
| 1002 | (or (member foo) null)) | 1002 | '(or (member foo) null)) |
| 1003 | 1003 | ||
| 1004 | ;; 22 | 1004 | ;; 22 |
| 1005 | ((defun comp-tests-ret-type-spec-f (x) | 1005 | ((defun comp-tests-ret-type-spec-f (x) |
| 1006 | (when (> x 3) | 1006 | (when (> x 3) |
| 1007 | x)) | 1007 | x)) |
| 1008 | (or null float (integer 4 *))) | 1008 | '(or null float (integer 4 *))) |
| 1009 | 1009 | ||
| 1010 | ;; 23 | 1010 | ;; 23 |
| 1011 | ((defun comp-tests-ret-type-spec-f (x) | 1011 | ((defun comp-tests-ret-type-spec-f (x) |
| 1012 | (when (>= x 3) | 1012 | (when (>= x 3) |
| 1013 | x)) | 1013 | x)) |
| 1014 | (or null float (integer 3 *))) | 1014 | '(or null float (integer 3 *))) |
| 1015 | 1015 | ||
| 1016 | ;; 24 | 1016 | ;; 24 |
| 1017 | ((defun comp-tests-ret-type-spec-f (x) | 1017 | ((defun comp-tests-ret-type-spec-f (x) |
| 1018 | (when (< x 3) | 1018 | (when (< x 3) |
| 1019 | x)) | 1019 | x)) |
| 1020 | (or null float (integer * 2))) | 1020 | '(or null float (integer * 2))) |
| 1021 | 1021 | ||
| 1022 | ;; 25 | 1022 | ;; 25 |
| 1023 | ((defun comp-tests-ret-type-spec-f (x) | 1023 | ((defun comp-tests-ret-type-spec-f (x) |
| 1024 | (when (<= x 3) | 1024 | (when (<= x 3) |
| 1025 | x)) | 1025 | x)) |
| 1026 | (or null float (integer * 3))) | 1026 | '(or null float (integer * 3))) |
| 1027 | 1027 | ||
| 1028 | ;; 26 | 1028 | ;; 26 |
| 1029 | ((defun comp-tests-ret-type-spec-f (x) | 1029 | ((defun comp-tests-ret-type-spec-f (x) |
| 1030 | (when (> 3 x) | 1030 | (when (> 3 x) |
| 1031 | x)) | 1031 | x)) |
| 1032 | (or null float (integer * 2))) | 1032 | '(or null float (integer * 2))) |
| 1033 | 1033 | ||
| 1034 | ;; 27 | 1034 | ;; 27 |
| 1035 | ((defun comp-tests-ret-type-spec-f (x) | 1035 | ((defun comp-tests-ret-type-spec-f (x) |
| 1036 | (when (>= 3 x) | 1036 | (when (>= 3 x) |
| 1037 | x)) | 1037 | x)) |
| 1038 | (or null float (integer * 3))) | 1038 | '(or null float (integer * 3))) |
| 1039 | 1039 | ||
| 1040 | ;; 28 | 1040 | ;; 28 |
| 1041 | ((defun comp-tests-ret-type-spec-f (x) | 1041 | ((defun comp-tests-ret-type-spec-f (x) |
| 1042 | (when (< 3 x) | 1042 | (when (< 3 x) |
| 1043 | x)) | 1043 | x)) |
| 1044 | (or null float (integer 4 *))) | 1044 | '(or null float (integer 4 *))) |
| 1045 | 1045 | ||
| 1046 | ;; 29 | 1046 | ;; 29 |
| 1047 | ((defun comp-tests-ret-type-spec-f (x) | 1047 | ((defun comp-tests-ret-type-spec-f (x) |
| 1048 | (when (<= 3 x) | 1048 | (when (<= 3 x) |
| 1049 | x)) | 1049 | x)) |
| 1050 | (or null float (integer 3 *))) | 1050 | '(or null float (integer 3 *))) |
| 1051 | 1051 | ||
| 1052 | ;; 30 | 1052 | ;; 30 |
| 1053 | ((defun comp-tests-ret-type-spec-f (x) | 1053 | ((defun comp-tests-ret-type-spec-f (x) |
| 1054 | (let ((y 3)) | 1054 | (let ((y 3)) |
| 1055 | (when (> x y) | 1055 | (when (> x y) |
| 1056 | x))) | 1056 | x))) |
| 1057 | (or null float (integer 4 *))) | 1057 | '(or null float (integer 4 *))) |
| 1058 | 1058 | ||
| 1059 | ;; 31 | 1059 | ;; 31 |
| 1060 | ((defun comp-tests-ret-type-spec-f (x) | 1060 | ((defun comp-tests-ret-type-spec-f (x) |
| 1061 | (let ((y 3)) | 1061 | (let ((y 3)) |
| 1062 | (when (> y x) | 1062 | (when (> y x) |
| 1063 | x))) | 1063 | x))) |
| 1064 | (or null float (integer * 2))) | 1064 | '(or null float (integer * 2))) |
| 1065 | 1065 | ||
| 1066 | ;; 32 | 1066 | ;; 32 |
| 1067 | ((defun comp-tests-ret-type-spec-f (x) | 1067 | ((defun comp-tests-ret-type-spec-f (x) |
| 1068 | (when (and (> x 3) | 1068 | (when (and (> x 3) |
| 1069 | (< x 10)) | 1069 | (< x 10)) |
| 1070 | x)) | 1070 | x)) |
| 1071 | (or null float (integer 4 9))) | 1071 | '(or null float (integer 4 9))) |
| 1072 | 1072 | ||
| 1073 | ;; 33 | 1073 | ;; 33 |
| 1074 | ((defun comp-tests-ret-type-spec-f (x) | 1074 | ((defun comp-tests-ret-type-spec-f (x) |
| 1075 | (when (or (> x 3) | 1075 | (when (or (> x 3) |
| 1076 | (< x 10)) | 1076 | (< x 10)) |
| 1077 | x)) | 1077 | x)) |
| 1078 | (or null float integer)) | 1078 | '(or null float integer)) |
| 1079 | 1079 | ||
| 1080 | ;; 34 | 1080 | ;; 34 |
| 1081 | ((defun comp-tests-ret-type-spec-f (x) | 1081 | ((defun comp-tests-ret-type-spec-f (x) |
| 1082 | (when (or (< x 3) | 1082 | (when (or (< x 3) |
| 1083 | (> x 10)) | 1083 | (> x 10)) |
| 1084 | x)) | 1084 | x)) |
| 1085 | (or null float (integer * 2) (integer 11 *))) | 1085 | '(or null float (integer * 2) (integer 11 *))) |
| 1086 | 1086 | ||
| 1087 | ;; 35 No float range support. | 1087 | ;; 35 No float range support. |
| 1088 | ((defun comp-tests-ret-type-spec-f (x) | 1088 | ((defun comp-tests-ret-type-spec-f (x) |
| 1089 | (when (> x 1.0) | 1089 | (when (> x 1.0) |
| 1090 | x)) | 1090 | x)) |
| 1091 | (or null marker number)) | 1091 | '(or null marker number)) |
| 1092 | 1092 | ||
| 1093 | ;; 36 | 1093 | ;; 36 |
| 1094 | ((defun comp-tests-ret-type-spec-f (x y) | 1094 | ((defun comp-tests-ret-type-spec-f (x y) |
| 1095 | (when (and (> x 3) | 1095 | (when (and (> x 3) |
| 1096 | (> y 2)) | 1096 | (> y 2)) |
| 1097 | (+ x y))) | 1097 | (+ x y))) |
| 1098 | (or null float (integer 7 *))) | 1098 | '(or null float (integer 7 *))) |
| 1099 | 1099 | ||
| 1100 | ;; 37 | 1100 | ;; 37 |
| 1101 | ;; SBCL: (OR REAL NULL) | 1101 | ;; SBCL: (OR REAL NULL) |
| @@ -1103,14 +1103,14 @@ Return a list of results." | |||
| 1103 | (when (and (<= x 3) | 1103 | (when (and (<= x 3) |
| 1104 | (<= y 2)) | 1104 | (<= y 2)) |
| 1105 | (+ x y))) | 1105 | (+ x y))) |
| 1106 | (or null float (integer * 5))) | 1106 | '(or null float (integer * 5))) |
| 1107 | 1107 | ||
| 1108 | ;; 38 | 1108 | ;; 38 |
| 1109 | ((defun comp-tests-ret-type-spec-f (x y) | 1109 | ((defun comp-tests-ret-type-spec-f (x y) |
| 1110 | (when (and (< 1 x 5) | 1110 | (when (and (< 1 x 5) |
| 1111 | (< 1 y 5)) | 1111 | (< 1 y 5)) |
| 1112 | (+ x y))) | 1112 | (+ x y))) |
| 1113 | (or null float (integer 4 8))) | 1113 | '(or null float (integer 4 8))) |
| 1114 | 1114 | ||
| 1115 | ;; 39 | 1115 | ;; 39 |
| 1116 | ;; SBCL gives: (OR REAL NULL) | 1116 | ;; SBCL gives: (OR REAL NULL) |
| @@ -1118,7 +1118,7 @@ Return a list of results." | |||
| 1118 | (when (and (<= 1 x 10) | 1118 | (when (and (<= 1 x 10) |
| 1119 | (<= 2 y 3)) | 1119 | (<= 2 y 3)) |
| 1120 | (+ x y))) | 1120 | (+ x y))) |
| 1121 | (or null float (integer 3 13))) | 1121 | '(or null float (integer 3 13))) |
| 1122 | 1122 | ||
| 1123 | ;; 40 | 1123 | ;; 40 |
| 1124 | ;; SBCL: (OR REAL NULL) | 1124 | ;; SBCL: (OR REAL NULL) |
| @@ -1126,42 +1126,42 @@ Return a list of results." | |||
| 1126 | (when (and (<= 1 x 10) | 1126 | (when (and (<= 1 x 10) |
| 1127 | (<= 2 y 3)) | 1127 | (<= 2 y 3)) |
| 1128 | (- x y))) | 1128 | (- x y))) |
| 1129 | (or null float (integer -2 8))) | 1129 | '(or null float (integer -2 8))) |
| 1130 | 1130 | ||
| 1131 | ;; 41 | 1131 | ;; 41 |
| 1132 | ((defun comp-tests-ret-type-spec-f (x y) | 1132 | ((defun comp-tests-ret-type-spec-f (x y) |
| 1133 | (when (and (<= 1 x) | 1133 | (when (and (<= 1 x) |
| 1134 | (<= 2 y 3)) | 1134 | (<= 2 y 3)) |
| 1135 | (- x y))) | 1135 | (- x y))) |
| 1136 | (or null float (integer -2 *))) | 1136 | '(or null float (integer -2 *))) |
| 1137 | 1137 | ||
| 1138 | ;; 42 | 1138 | ;; 42 |
| 1139 | ((defun comp-tests-ret-type-spec-f (x y) | 1139 | ((defun comp-tests-ret-type-spec-f (x y) |
| 1140 | (when (and (<= 1 x 10) | 1140 | (when (and (<= 1 x 10) |
| 1141 | (<= 2 y)) | 1141 | (<= 2 y)) |
| 1142 | (- x y))) | 1142 | (- x y))) |
| 1143 | (or null float (integer * 8))) | 1143 | '(or null float (integer * 8))) |
| 1144 | 1144 | ||
| 1145 | ;; 43 | 1145 | ;; 43 |
| 1146 | ((defun comp-tests-ret-type-spec-f (x y) | 1146 | ((defun comp-tests-ret-type-spec-f (x y) |
| 1147 | (when (and (<= x 10) | 1147 | (when (and (<= x 10) |
| 1148 | (<= 2 y)) | 1148 | (<= 2 y)) |
| 1149 | (- x y))) | 1149 | (- x y))) |
| 1150 | (or null float (integer * 8))) | 1150 | '(or null float (integer * 8))) |
| 1151 | 1151 | ||
| 1152 | ;; 44 | 1152 | ;; 44 |
| 1153 | ((defun comp-tests-ret-type-spec-f (x y) | 1153 | ((defun comp-tests-ret-type-spec-f (x y) |
| 1154 | (when (and (<= x 10) | 1154 | (when (and (<= x 10) |
| 1155 | (<= y 3)) | 1155 | (<= y 3)) |
| 1156 | (- x y))) | 1156 | (- x y))) |
| 1157 | (or null float integer)) | 1157 | '(or null float integer)) |
| 1158 | 1158 | ||
| 1159 | ;; 45 | 1159 | ;; 45 |
| 1160 | ((defun comp-tests-ret-type-spec-f (x y) | 1160 | ((defun comp-tests-ret-type-spec-f (x y) |
| 1161 | (when (and (<= 2 x) | 1161 | (when (and (<= 2 x) |
| 1162 | (<= 3 y)) | 1162 | (<= 3 y)) |
| 1163 | (- x y))) | 1163 | (- x y))) |
| 1164 | (or null float integer)) | 1164 | '(or null float integer)) |
| 1165 | 1165 | ||
| 1166 | ;; 46 | 1166 | ;; 46 |
| 1167 | ;; SBCL: (OR (RATIONAL (6) (30)) (SINGLE-FLOAT 6.0 30.0) | 1167 | ;; SBCL: (OR (RATIONAL (6) (30)) (SINGLE-FLOAT 6.0 30.0) |
| @@ -1174,63 +1174,63 @@ Return a list of results." | |||
| 1174 | (< 1 j 5) | 1174 | (< 1 j 5) |
| 1175 | (< 1 k 5)) | 1175 | (< 1 k 5)) |
| 1176 | (+ x y z i j k))) | 1176 | (+ x y z i j k))) |
| 1177 | (or null float (integer 12 24))) | 1177 | '(or null float (integer 12 24))) |
| 1178 | 1178 | ||
| 1179 | ;; 47 | 1179 | ;; 47 |
| 1180 | ((defun comp-tests-ret-type-spec-f (x) | 1180 | ((defun comp-tests-ret-type-spec-f (x) |
| 1181 | (when (<= 1 x 5) | 1181 | (when (<= 1 x 5) |
| 1182 | (1+ x))) | 1182 | (1+ x))) |
| 1183 | (or null float (integer 2 6))) | 1183 | '(or null float (integer 2 6))) |
| 1184 | 1184 | ||
| 1185 | ;;48 | 1185 | ;;48 |
| 1186 | ((defun comp-tests-ret-type-spec-f (x) | 1186 | ((defun comp-tests-ret-type-spec-f (x) |
| 1187 | (when (<= 1 x 5) | 1187 | (when (<= 1 x 5) |
| 1188 | (1- x))) | 1188 | (1- x))) |
| 1189 | (or null float (integer 0 4))) | 1189 | '(or null float (integer 0 4))) |
| 1190 | 1190 | ||
| 1191 | ;; 49 | 1191 | ;; 49 |
| 1192 | ((defun comp-tests-ret-type-spec-f () | 1192 | ((defun comp-tests-ret-type-spec-f () |
| 1193 | (error "Foo")) | 1193 | (error "Foo")) |
| 1194 | nil) | 1194 | 'nil) |
| 1195 | 1195 | ||
| 1196 | ;; 50 | 1196 | ;; 50 |
| 1197 | ((defun comp-tests-ret-type-spec-f (x) | 1197 | ((defun comp-tests-ret-type-spec-f (x) |
| 1198 | (if (stringp x) | 1198 | (if (stringp x) |
| 1199 | x | 1199 | x |
| 1200 | 'bar)) | 1200 | 'bar)) |
| 1201 | (or (member bar) string)) | 1201 | '(or (member bar) string)) |
| 1202 | 1202 | ||
| 1203 | ;; 51 | 1203 | ;; 51 |
| 1204 | ((defun comp-tests-ret-type-spec-f (x) | 1204 | ((defun comp-tests-ret-type-spec-f (x) |
| 1205 | (if (stringp x) | 1205 | (if (stringp x) |
| 1206 | 'bar | 1206 | 'bar |
| 1207 | x)) | 1207 | x)) |
| 1208 | (not string)) | 1208 | '(not string)) |
| 1209 | 1209 | ||
| 1210 | ;; 52 | 1210 | ;; 52 |
| 1211 | ((defun comp-tests-ret-type-spec-f (x) | 1211 | ((defun comp-tests-ret-type-spec-f (x) |
| 1212 | (if (integerp x) | 1212 | (if (integerp x) |
| 1213 | x | 1213 | x |
| 1214 | 'bar)) | 1214 | 'bar)) |
| 1215 | (or (member bar) integer)) | 1215 | '(or (member bar) integer)) |
| 1216 | 1216 | ||
| 1217 | ;; 53 | 1217 | ;; 53 |
| 1218 | ((defun comp-tests-ret-type-spec-f (x) | 1218 | ((defun comp-tests-ret-type-spec-f (x) |
| 1219 | (when (integerp x) | 1219 | (when (integerp x) |
| 1220 | x)) | 1220 | x)) |
| 1221 | (or null integer)) | 1221 | '(or null integer)) |
| 1222 | 1222 | ||
| 1223 | ;; 54 | 1223 | ;; 54 |
| 1224 | ((defun comp-tests-ret-type-spec-f (x) | 1224 | ((defun comp-tests-ret-type-spec-f (x) |
| 1225 | (unless (symbolp x) | 1225 | (unless (symbolp x) |
| 1226 | x)) | 1226 | x)) |
| 1227 | t) | 1227 | 't) |
| 1228 | 1228 | ||
| 1229 | ;; 55 | 1229 | ;; 55 |
| 1230 | ((defun comp-tests-ret-type-spec-f (x) | 1230 | ((defun comp-tests-ret-type-spec-f (x) |
| 1231 | (unless (integerp x) | 1231 | (unless (integerp x) |
| 1232 | x)) | 1232 | x)) |
| 1233 | (not integer)) | 1233 | '(not integer)) |
| 1234 | 1234 | ||
| 1235 | ;; 56 | 1235 | ;; 56 |
| 1236 | ((defun comp-tests-ret-type-spec-f (x) | 1236 | ((defun comp-tests-ret-type-spec-f (x) |
| @@ -1238,7 +1238,7 @@ Return a list of results." | |||
| 1238 | (1 (message "one")) | 1238 | (1 (message "one")) |
| 1239 | (5 (message "five"))) | 1239 | (5 (message "five"))) |
| 1240 | x) | 1240 | x) |
| 1241 | t | 1241 | 't |
| 1242 | ;; FIXME improve `comp-cond-cstrs-target-mvar' to cross block | 1242 | ;; FIXME improve `comp-cond-cstrs-target-mvar' to cross block |
| 1243 | ;; boundary if necessary as this should return: | 1243 | ;; boundary if necessary as this should return: |
| 1244 | ;; (or (integer 1 1) (integer 5 5)) | 1244 | ;; (or (integer 1 1) (integer 5 5)) |
| @@ -1250,7 +1250,7 @@ Return a list of results." | |||
| 1250 | (eql x 3)) | 1250 | (eql x 3)) |
| 1251 | (error "Not foo or 3")) | 1251 | (error "Not foo or 3")) |
| 1252 | x) | 1252 | x) |
| 1253 | (or (member foo) (integer 3 3))) | 1253 | '(or (member foo) (integer 3 3))) |
| 1254 | 1254 | ||
| 1255 | ;;58 | 1255 | ;;58 |
| 1256 | ((defun comp-tests-ret-type-spec-f (x y) | 1256 | ((defun comp-tests-ret-type-spec-f (x y) |
| @@ -1259,7 +1259,7 @@ Return a list of results." | |||
| 1259 | (<= x y)) | 1259 | (<= x y)) |
| 1260 | x | 1260 | x |
| 1261 | (error ""))) | 1261 | (error ""))) |
| 1262 | (integer 0 *)) | 1262 | '(integer 0 *)) |
| 1263 | 1263 | ||
| 1264 | ;; 59 | 1264 | ;; 59 |
| 1265 | ((defun comp-tests-ret-type-spec-f (x y) | 1265 | ((defun comp-tests-ret-type-spec-f (x y) |
| @@ -1268,7 +1268,7 @@ Return a list of results." | |||
| 1268 | (<= x y)) | 1268 | (<= x y)) |
| 1269 | x | 1269 | x |
| 1270 | (error ""))) | 1270 | (error ""))) |
| 1271 | (or float (integer 3 10))) | 1271 | '(or float (integer 3 10))) |
| 1272 | 1272 | ||
| 1273 | ;; 60 | 1273 | ;; 60 |
| 1274 | ((defun comp-tests-ret-type-spec-f (x y) | 1274 | ((defun comp-tests-ret-type-spec-f (x y) |
| @@ -1277,56 +1277,56 @@ Return a list of results." | |||
| 1277 | (>= x y)) | 1277 | (>= x y)) |
| 1278 | x | 1278 | x |
| 1279 | (error ""))) | 1279 | (error ""))) |
| 1280 | (or float (integer 3 10))) | 1280 | '(or float (integer 3 10))) |
| 1281 | 1281 | ||
| 1282 | ;; 61 | 1282 | ;; 61 |
| 1283 | ((defun comp-tests-ret-type-spec-f (x) | 1283 | ((defun comp-tests-ret-type-spec-f (x) |
| 1284 | (if (= x 1.0) | 1284 | (if (= x 1.0) |
| 1285 | x | 1285 | x |
| 1286 | (error ""))) | 1286 | (error ""))) |
| 1287 | (or (member 1.0) (integer 1 1))) | 1287 | '(or (member 1.0) (integer 1 1))) |
| 1288 | 1288 | ||
| 1289 | ;; 62 | 1289 | ;; 62 |
| 1290 | ((defun comp-tests-ret-type-spec-f (x) | 1290 | ((defun comp-tests-ret-type-spec-f (x) |
| 1291 | (if (= x 1.0) | 1291 | (if (= x 1.0) |
| 1292 | x | 1292 | x |
| 1293 | (error ""))) | 1293 | (error ""))) |
| 1294 | (or (member 1.0) (integer 1 1))) | 1294 | '(or (member 1.0) (integer 1 1))) |
| 1295 | 1295 | ||
| 1296 | ;; 63 | 1296 | ;; 63 |
| 1297 | ((defun comp-tests-ret-type-spec-f (x) | 1297 | ((defun comp-tests-ret-type-spec-f (x) |
| 1298 | (if (= x 1.1) | 1298 | (if (= x 1.1) |
| 1299 | x | 1299 | x |
| 1300 | (error ""))) | 1300 | (error ""))) |
| 1301 | (member 1.1)) | 1301 | '(member 1.1)) |
| 1302 | 1302 | ||
| 1303 | ;; 64 | 1303 | ;; 64 |
| 1304 | ((defun comp-tests-ret-type-spec-f (x) | 1304 | ((defun comp-tests-ret-type-spec-f (x) |
| 1305 | (if (= x 1) | 1305 | (if (= x 1) |
| 1306 | x | 1306 | x |
| 1307 | (error ""))) | 1307 | (error ""))) |
| 1308 | (or (member 1.0) (integer 1 1))) | 1308 | '(or (member 1.0) (integer 1 1))) |
| 1309 | 1309 | ||
| 1310 | ;; 65 | 1310 | ;; 65 |
| 1311 | ((defun comp-tests-ret-type-spec-f (x) | 1311 | ((defun comp-tests-ret-type-spec-f (x) |
| 1312 | (if (= x 1) | 1312 | (if (= x 1) |
| 1313 | x | 1313 | x |
| 1314 | (error ""))) | 1314 | (error ""))) |
| 1315 | (or (member 1.0) (integer 1 1))) | 1315 | '(or (member 1.0) (integer 1 1))) |
| 1316 | 1316 | ||
| 1317 | ;; 66 | 1317 | ;; 66 |
| 1318 | ((defun comp-tests-ret-type-spec-f (x) | 1318 | ((defun comp-tests-ret-type-spec-f (x) |
| 1319 | (if (eql x 0.0) | 1319 | (if (eql x 0.0) |
| 1320 | x | 1320 | x |
| 1321 | (error ""))) | 1321 | (error ""))) |
| 1322 | float) | 1322 | 'float) |
| 1323 | 1323 | ||
| 1324 | ;; 67 | 1324 | ;; 67 |
| 1325 | ((defun comp-tests-ret-type-spec-f (x) | 1325 | ((defun comp-tests-ret-type-spec-f (x) |
| 1326 | (if (equal x '(1 2 3)) | 1326 | (if (equal x '(1 2 3)) |
| 1327 | x | 1327 | x |
| 1328 | (error ""))) | 1328 | (error ""))) |
| 1329 | cons) | 1329 | 'cons) |
| 1330 | 1330 | ||
| 1331 | ;; 68 | 1331 | ;; 68 |
| 1332 | ((defun comp-tests-ret-type-spec-f (x) | 1332 | ((defun comp-tests-ret-type-spec-f (x) |
| @@ -1335,7 +1335,7 @@ Return a list of results." | |||
| 1335 | x | 1335 | x |
| 1336 | (error ""))) | 1336 | (error ""))) |
| 1337 | ;; Conservative (see cstr relax in `comp-cstr-='). | 1337 | ;; Conservative (see cstr relax in `comp-cstr-='). |
| 1338 | (or (member 1.0) (integer 1 1))) | 1338 | '(or (member 1.0) (integer 1 1))) |
| 1339 | 1339 | ||
| 1340 | ;; 69 | 1340 | ;; 69 |
| 1341 | ((defun comp-tests-ret-type-spec-f (x) | 1341 | ((defun comp-tests-ret-type-spec-f (x) |
| @@ -1344,7 +1344,7 @@ Return a list of results." | |||
| 1344 | x | 1344 | x |
| 1345 | (error ""))) | 1345 | (error ""))) |
| 1346 | ;; Conservative (see cstr relax in `comp-cstr-='). | 1346 | ;; Conservative (see cstr relax in `comp-cstr-='). |
| 1347 | (or (member 1.0) (integer 1 1))) | 1347 | '(or (member 1.0) (integer 1 1))) |
| 1348 | 1348 | ||
| 1349 | ;; 70 | 1349 | ;; 70 |
| 1350 | ((defun comp-tests-ret-type-spec-f (x y) | 1350 | ((defun comp-tests-ret-type-spec-f (x y) |
| @@ -1353,14 +1353,14 @@ Return a list of results." | |||
| 1353 | (= x y)) | 1353 | (= x y)) |
| 1354 | x | 1354 | x |
| 1355 | (error ""))) | 1355 | (error ""))) |
| 1356 | (or float integer)) | 1356 | '(or float integer)) |
| 1357 | 1357 | ||
| 1358 | ;; 71 | 1358 | ;; 71 |
| 1359 | ((defun comp-tests-ret-type-spec-f (x) | 1359 | ((defun comp-tests-ret-type-spec-f (x) |
| 1360 | (if (= x 0.0) | 1360 | (if (= x 0.0) |
| 1361 | x | 1361 | x |
| 1362 | (error ""))) | 1362 | (error ""))) |
| 1363 | (or (member -0.0 0.0) (integer 0 0))) | 1363 | '(or (member -0.0 0.0) (integer 0 0))) |
| 1364 | 1364 | ||
| 1365 | ;; 72 | 1365 | ;; 72 |
| 1366 | ((defun comp-tests-ret-type-spec-f (x) | 1366 | ((defun comp-tests-ret-type-spec-f (x) |
| @@ -1369,27 +1369,27 @@ Return a list of results." | |||
| 1369 | (unless (eql x -0.0) | 1369 | (unless (eql x -0.0) |
| 1370 | (error "")) | 1370 | (error "")) |
| 1371 | x) | 1371 | x) |
| 1372 | float) | 1372 | 'float) |
| 1373 | 1373 | ||
| 1374 | ;; 73 | 1374 | ;; 73 |
| 1375 | ((defun comp-tests-ret-type-spec-f (x) | 1375 | ((defun comp-tests-ret-type-spec-f (x) |
| 1376 | (when (eql x 1.0) | 1376 | (when (eql x 1.0) |
| 1377 | (error "")) | 1377 | (error "")) |
| 1378 | x) | 1378 | x) |
| 1379 | t) | 1379 | 't) |
| 1380 | 1380 | ||
| 1381 | ;; 74 | 1381 | ;; 74 |
| 1382 | ((defun comp-tests-ret-type-spec-f (x) | 1382 | ((defun comp-tests-ret-type-spec-f (x) |
| 1383 | (if (eq x 0) | 1383 | (if (eq x 0) |
| 1384 | (error "") | 1384 | (error "") |
| 1385 | (1+ x))) | 1385 | (1+ x))) |
| 1386 | number))) | 1386 | 'number))) |
| 1387 | 1387 | ||
| 1388 | (defun comp-tests-define-type-spec-test (number x) | 1388 | (defun comp-tests-define-type-spec-test (number x) |
| 1389 | `(comp-deftest ,(intern (format "ret-type-spec-%d" number)) () | 1389 | `(comp-deftest ,(intern (format "ret-type-spec-%d" number)) () |
| 1390 | ,(format "Type specifier test number %d." number) | 1390 | ,(format "Type specifier test number %d." number) |
| 1391 | (let ((comp-ctxt (make-comp-cstr-ctxt))) | 1391 | (let ((comp-ctxt (make-comp-cstr-ctxt))) |
| 1392 | (comp-tests-check-ret-type-spec ',(car x) ',(cadr x)))))) | 1392 | (comp-tests-check-ret-type-spec ',(car x) ,(cadr x)))))) |
| 1393 | 1393 | ||
| 1394 | (defmacro comp-tests-define-type-spec-tests () | 1394 | (defmacro comp-tests-define-type-spec-tests () |
| 1395 | "Define all type specifier tests." | 1395 | "Define all type specifier tests." |
| @@ -1472,13 +1472,4 @@ folded." | |||
| 1472 | (equal (comp-mvar-typeset mvar) | 1472 | (equal (comp-mvar-typeset mvar) |
| 1473 | comp-tests-cond-rw-expected-type)))))))) | 1473 | comp-tests-cond-rw-expected-type)))))))) |
| 1474 | 1474 | ||
| 1475 | ;; We don't want to byte compile this to avoid recording in the | ||
| 1476 | ;; bytecode the architecture-dependent values of most-positive-fixnum | ||
| 1477 | ;; and most-negative-fixnum, thus making the byte-compiled file | ||
| 1478 | ;; non-portable. | ||
| 1479 | |||
| 1480 | ;; Local Variables: | ||
| 1481 | ;; no-byte-compile: t | ||
| 1482 | ;; End: | ||
| 1483 | |||
| 1484 | ;;; comp-tests.el ends here | 1475 | ;;; comp-tests.el ends here |