Commit Graph

36 Commits

Author SHA1 Message Date
David Mak 13f06f3e29 core: Refactor VarMap to IndexMap
This is the only Map I can find that preserves insertion order while
also deduplicating elements by key.
2024-03-22 15:51:23 +08:00
David Mak 77de24ef74 core: Use BTreeMap for type variable mapping
There have been multiple instances where I had the need to iterate over
type variables, only to discover that the traversal order is arbitrary.

This commit fixes that by adding SortedMapping, which utilizes BTreeMap
internally to guarantee a traversal order. All instances of VarMap are
now refactored to use this to ensure that type variables are iterated in
 the order of its variable ID, which should be monotonically incremented
 by the unifier.
2024-03-04 23:56:04 +08:00
David Mak 234a6bde2a core: Use TObj for NDArray 2024-03-01 15:41:55 +08:00
David Mak e3e2c36ef4 core: Mark TNDArray and TLiteral as unimplemented in tests 2024-01-17 09:58:14 +08:00
David Mak c395472094 core: Initial infrastructure for ndarray 2023-12-21 15:39:46 +08:00
David Mak a19f1065e3 meta: Refactor to use more let-else bindings 2023-12-12 16:31:14 +08:00
David Mak 4dc5dbb856 meta: Replace equality assertion with assert_eq
Emits a more useful assertion message.
2023-12-11 15:16:23 +08:00
David Mak 5182453bd9 meta: Remove redundant path prefixes 2023-12-11 15:16:23 +08:00
ychenfo 48cb485b89 nac3core: show outer type info in type error messages
Reviewed-on: #274
Co-authored-by: ychenfo <yc@m-labs.hk>
Co-committed-by: ychenfo <yc@m-labs.hk>
2022-04-22 15:31:55 +08:00
wylited e94b25f544 spelling (#264)
Co-authored-by: wylited <ds@m-labs.hk>
Co-committed-by: wylited <ds@m-labs.hk>
2022-04-13 11:32:31 +08:00
Sebastien Bourdeauducq 1e7abf0268 fix tests 2022-04-12 10:06:41 +08:00
Sebastien Bourdeauducq 5cd4fe6507 update tests 2022-02-23 11:50:03 +08:00
Sebastien Bourdeauducq 75fde1bbf7 update tests 2022-02-23 11:39:47 +08:00
pca006132 f97f93d92c applied rustfmt and clippy auto fix 2022-02-21 18:27:46 +08:00
pca006132 d9cb506f6a nac3core: refactored for better error messages 2022-02-21 18:24:19 +08:00
Sebastien Bourdeauducq 96607432c1 nac3core: use Python 3.9 list/tuple annotations in test
Closes #85
2021-11-11 20:05:08 +08:00
pca006132 b1e83a1fd4 nac3core: type check invariants
This rejects code that tries to assign to KernelInvariant fields and
methods.
2021-11-06 22:48:08 +08:00
pca006132 26076c37ba nac3core/typecheck: supports recursive type inference 2021-10-16 15:56:49 +08:00
pca006132 084efe92af nac3core: use string interning 2021-09-22 18:04:06 +08:00
pca006132 180392e2ab typecheck: fixed recursive substitution 2021-09-12 21:33:21 +08:00
ychenfo 7b1fe36e90 formatted 2021-08-23 11:13:45 +08:00
ychenfo fb5b4697a9 fix rebase conflict and some test failure with unifier's error message 2021-08-23 10:34:11 +08:00
ychenfo fa40fd73c6 formatted 2021-08-16 20:17:08 +08:00
ychenfo 3734663188 add RefCell to FunSignature in TypeEnum 2021-08-16 13:53:45 +08:00
ychenfo 3a93e2b048 TypeEnum::TObj.param is now RefCell for interior mutability 2021-08-12 13:17:51 +08:00
ychenfo 18db2ddd53 change the type TypeEnum::TObj {object_id} to DefinitionId as with top_level
change TopLevelDef::Class {object_id} to DefinitionId
2021-08-06 10:57:01 +08:00
pca006132 29286210b5 implementing codegen 2021-08-05 14:56:09 +08:00
CrescentonC a7e3eeea0d add primitive magic method support; change from TypeEnum::TObj { fields: Mapping<String>, ..} to TypeEnum::TObj {fields: RefCell<Mapping<String>>, .. } for interior mutability 2021-08-02 17:36:37 +08:00
pca006132 197a72c658 added comment 2021-07-30 16:43:25 +08:00
pca006132 eba92ed8bd added method to get all instantiations 2021-07-30 16:32:50 +08:00
pca006132 743a9384a3 added rigid type variable 2021-07-30 11:28:27 +08:00
pca006132 bf31c48bba fixed missing unification 2021-07-26 14:20:47 +08:00
pca006132 8618837816 fixed range unification 2021-07-26 12:00:06 +08:00
pca006132 d7df93bef1 fixed range check 2021-07-23 17:22:05 +08:00
pca006132 ddcf4b7e39 refactored typedef 2021-07-23 15:57:37 +08:00
pca006132 2f5c3b3cb7 more cleanup and started adding tests 2021-07-21 15:36:35 +08:00