Carp/test
Scott Olsen d82e8a5a3f
refactor: add type candidates and template generators (#1361)
* refactor: add type candidates for validation

This commit adds a new module and type, the TypeCandidate, which
represents a potentially valid or invalid type. We use it as the
input for both type validation routines and type binding generation. The
type also allows us to unify the structure of sum types and product
types in an xobj agnostic way, paving the way for future simplification
of binding generation for type definitions.

This commit also removes SumtypeCase.hs, since it's no longer needed.

* refactor: add template generators; update type templates

This commit builds on the TypeCandidate data structure further by
providing "template generators" that work on candidates. Using
generators, templates for type functions ("methods") can be written
almost completely declaratively. Generators also remove some of the
typical boilerplate involved in creating templates from lists of tokens
and enable us to unify several of the generic and concrete templates for
types.

Generators can act on type candidates or their fields (for
field-specific functions). In general, this approach makes the
generation of type templates more structured. A type candidate now
contains all the information a generator needs to create appropriate
templates, thus it is a single and well-defined input for validation and
generation of user defined types.

This commit also updates the Deftype templates to use template
generators.

* refactor: use template generators for sumtype templates
2021-12-20 15:41:14 +01:00
..
output refactor: add type candidates and template generators (#1361) 2021-12-20 15:41:14 +01:00
produces-output test: REPL (#1239) 2021-06-15 08:02:44 +02:00
test-for-errors test: add match given-away value error test (#1351) 2021-10-28 10:18:38 +02:00
add-c.carp Implement load-stack. 2020-06-28 19:53:43 +02:00
address.carp feat: Remove address (#1223) 2021-05-27 22:04:46 +02:00
args.carp Add support for cross-compilation. 2020-10-10 20:01:18 +02:00
array.carp feat: scan functions (#1339) 2021-10-22 06:59:40 +02:00
binary.carp test: add assert-ref-equal, assert-just, and assert-nothing 2020-05-12 14:53:42 +02:00
box.carp feat: add box type (#1358) 2021-11-30 10:35:22 +01:00
byte_math.carp core: add a byte type 2019-11-01 10:52:34 +01:00
char.carp feat: add Char.to-byte and Char.from-byte (#1187) 2021-03-16 11:14:16 +01:00
check.sh Fix nixpkgs build. 2020-11-14 15:28:17 +01:00
control_flow.carp Fix all nth usage 2019-10-31 06:23:23 -03:00
control_macros.carp feat: Add additional ignore macros (#1300) 2021-08-23 20:31:10 +02:00
csquare.c Implement load-stack. 2020-06-28 19:53:43 +02:00
csquare.h Implement load-stack. 2020-06-28 19:53:43 +02:00
deftype.carp Refactor: clean up Env module, store type environments in modules (#1207) 2021-05-19 19:20:48 +02:00
derive.carp feat: Derive (#1120) 2021-01-15 10:48:34 +01:00
double_math.carp Use Double.approx to compare exp results 2020-05-13 16:52:32 +02:00
dynamic_map.carp feat: add dynamic Map type (#1168) 2021-02-11 09:12:58 +01:00
dynamic-closures.carp fix: allow dynamic closures to mutate the global env (#1184) 2021-03-09 23:30:49 +01:00
execute.sh Make sure output directory is right in test (#1089) 2020-12-22 10:36:43 +01:00
filepath.carp The '(load)' command will work relative to the file containing it, if 2019-03-22 20:33:06 +01:00
fixture_file.txt dynamic: add read-file 2019-05-14 13:51:27 -04:00
fixture_foo.h tests: add regression tests for #288 2018-09-18 16:47:16 +02:00
float_math.carp core: make from-string better 2020-05-12 22:33:40 +02:00
format.carp feat: add fstr (#1142) 2021-01-26 06:18:16 +01:00
function.carp Adds Function.unsafe-ptr & Function.unsafe-env-ptr (#1026) 2020-11-27 10:17:29 +01:00
generics.carp test: add generics 2020-01-28 21:32:15 +01:00
heap.carp core: rename unsafe-range to range-or-default 2020-05-24 12:26:18 +02:00
init_global.carp feat: 'delete' interface (deciding whether a type is managed or not) (#1061) 2020-12-20 21:21:14 +01:00
int8.carp Fixes StdInt.carp load in tests 2020-04-04 13:21:23 +01:00
int16.carp Fixes StdInt.carp load in tests 2020-04-04 13:21:23 +01:00
int32.carp Fixes StdInt.carp load in tests 2020-04-04 13:21:23 +01:00
int64.carp Fixes StdInt.carp load in tests 2020-04-04 13:21:23 +01:00
int_math.carp fix Map and Set behaviour for negative hash values 2018-12-01 18:01:02 +02:00
interface.carp feat: overwrite existing interface implementations (#1094) 2020-12-23 22:24:52 +01:00
interop.carp fix: permit registering types in modules (#1362) 2021-12-12 14:56:41 +01:00
interop.h fix: permit registering types in modules (#1362) 2021-12-12 14:56:41 +01:00
introspect.carp feat: add Introspect.arguments (#1163) 2021-02-01 17:03:38 +01:00
io.carp IO.Raw (#1243) 2021-06-17 17:33:10 +02:00
long_math.carp core: fix Long_copy 2018-12-09 18:07:19 +02:00
macros.carp feat: allow for multibranches in case (#1276) 2021-07-08 20:43:48 +02:00
managed.carp feat: 'delete' interface (deciding whether a type is managed or not) (#1061) 2020-12-20 21:21:14 +01:00
map.carp feat: add dynamic Map type (#1168) 2021-02-11 09:12:58 +01:00
maybe.carp feat: Remove address (#1223) 2021-05-27 22:04:46 +02:00
memory.carp feat: add box type (#1358) 2021-11-30 10:35:22 +01:00
nested.carp Add some more calls to implement to make tests pass 2020-05-10 13:32:22 -04:00
pattern.carp reorganize Pattern library (#1257) 2021-06-23 22:07:56 +02:00
pointer.carp fix: Pointer str & prn (#1060) 2020-12-09 06:19:07 +01:00
random-seed.carp feat: make reseeding of Random at startup configurable (#1161) 2021-01-29 17:38:39 +01:00
random.carp tests: remove determinism test 2020-10-15 13:16:49 +02:00
record.sh Fix nixpkgs build. 2020-11-14 15:28:17 +01:00
recursion.carp fix: support recursive let bindings in static code (Fix 402) (#1230) 2021-06-05 17:45:50 +02:00
regression.carp fix: #1261 (#1272) 2021-09-04 15:07:52 +02:00
reload.carp Add remaining implements declarations 2020-05-10 22:53:35 -04:00
result.carp core: remove result.zero 2020-04-30 14:40:01 +02:00
safe_arithmetic.carp test: remove safe arithmetic on windows 2020-04-24 11:04:01 +02:00
short_circuiting.carp (and) and (or) now handle any number of parameters (#1251) 2021-06-20 21:44:04 +02:00
sort.carp core: add sort flavors with custom comparators 2018-11-13 11:11:21 +01:00
Spec.hs refactor: Make Lookup module more focused and DRY (#1054) 2020-12-07 07:06:32 +01:00
static_array.carp feat: scan functions (#1339) 2021-10-22 06:59:40 +02:00
statistics.carp feat: 'delete' interface (deciding whether a type is managed or not) (#1061) 2020-12-20 21:21:14 +01:00
string.carp fix: escape quotes in String.prn (#1287) 2021-07-29 08:30:42 +02:00
sumtypes.carp Fix some memory errors (that should be compiler errors). 2020-05-05 14:08:07 +02:00
system.carp IO.Raw (#1243) 2021-06-17 17:33:10 +02:00
TestConstraints.hs Refactor: clean up Env module, store type environments in modules (#1207) 2021-05-19 19:20:48 +02:00
TestLookup.hs Refactor: clean up Env module, store type environments in modules (#1207) 2021-05-19 19:20:48 +02:00
tuples.carp core: autogenerate Tuple types and document 2020-05-24 11:49:27 +02:00
uint8.carp Fixes StdInt.carp load in tests 2020-04-04 13:21:23 +01:00
uint16.carp Fixes StdInt.carp load in tests 2020-04-04 13:21:23 +01:00
uint32.carp Fixes StdInt.carp load in tests 2020-04-04 13:21:23 +01:00
uint64.carp Fixes StdInt.carp load in tests 2020-04-04 13:21:23 +01:00
unicode.carp Merge 2020-05-11 16:10:35 +02:00
unsafe.carp Adds fn Unsafe.leak that prevents destructor from being run on a value 2020-04-10 14:56:20 +01:00
vector2.carp Various submodule fixes (#1078) 2020-12-18 21:45:28 +01:00
vector3.carp Various submodule fixes (#1078) 2020-12-18 21:45:28 +01:00
vectorn.carp Various submodule fixes (#1078) 2020-12-18 21:45:28 +01:00