Commit Graph

69 Commits (c74b7992f65bd0dba820ac6a2d4786a22b8c3b70)

Author SHA1 Message Date
David Nadlinger c74b7992f6 core/typecheck: Basic ndarray indexing support 2022-04-22 21:56:35 +01:00
David Nadlinger 72cb693e2e core/typecheck: First btis of NumPy-like array type inference
For readability of the codebase, I chose ndarray for the name of the
type, while [numpy.]array() is the name of the most commonly used
constructor.
2022-04-22 21:56:35 +01:00
David Nadlinger 8454741f9e cargo fmt the world 2022-04-22 21:56:35 +01:00
ychenfo 48cb485b89 nac3core: show outer type info in type error messages
Reviewed-on: M-Labs/nac3#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 ca07cb66cd format typevars consistently 2022-04-12 09:28:17 +08:00
ychenfo 80631fc92b Option type support (#224)
Co-authored-by: ychenfo <yc@m-labs.hk>
Co-committed-by: ychenfo <yc@m-labs.hk>
2022-03-26 15:09:15 +08:00
pca006132 41d62f7325 nac3core/toplevel: fixed typevar substitution bug 2022-03-23 00:25:10 +08:00
pca006132 35ac5cb6f6 nac3core: fixed typevar bug 2022-03-18 01:07:44 +08:00
ychenfo 42fbe8e383 nac3core: fix err msg of too many args 2022-03-05 03:59:45 +08:00
pca006132 0686e83f4c nac3core/typecheck: fixed incorrect rollback 2022-02-25 20:01:11 +08:00
pca006132 cc769a7006 nac3core: reset unification table state before printing errors
Fixes nondeterministic error messages due to nondeterministic
unification order. As all unification operations will be restored, the
error messages should not be affected by the unification order before
the failure operation.
2022-02-25 14:47:19 +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 142f82f987 remove debug prints 2021-12-01 22:48:06 +08:00
ychenfo 49476d06e1 nac3core: clearer comments 2021-11-22 15:06:16 +08:00
ychenfo c2706fa720 nac3core: fix polymorphic class method partial instantiation 2021-11-21 06:11:55 +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 8dbb4ad58a nac3core/toplevel: make test less fragile
test results should not depend on internal states if possible
2021-11-05 20:28:21 +08:00
Sebastien Bourdeauducq bf7e2c295a integrate nac3parser 2021-11-03 17:11:00 +08:00
pca006132 279f47f633 nac3core/codegen: avoid sending unifiers
Previously, we have to copy types from one unification table to another,
and make the table sendable. This requires cloning (processing) the
whole table 3 times per function call which is not efficient and uses
more memory than required when the unification table is large.

We now use a concrete type table to only copy the type we need. This
reduces the overhead as we only need to process the unification table
for once (when we do the function codegen), and reduces memory usage by
a bit (but not noticeable when the unification table is small, i.e. the
types are simple).
2021-10-17 13:02:18 +08:00
pca006132 26076c37ba nac3core/typecheck: supports recursive type inference 2021-10-16 15:56:49 +08:00
pca006132 105d605e6d nac3core: fix clippy warnings 2021-09-22 18:04:06 +08:00
pca006132 97f5b7c324 fixed performance regression 2021-09-22 18:04:06 +08:00
pca006132 084efe92af nac3core: use string interning 2021-09-22 18:04:06 +08:00
ychenfo dd1be541b8 nac3core: allow class to have no __init__, function/method name with module path added to ensure uniqueness 2021-09-20 23:36:19 +08:00
pca006132 180392e2ab typecheck: fixed recursive substitution 2021-09-12 21:33:21 +08:00
ychenfo 471547855e nac3core: toplevel change class method name handling, cleanup comments 2021-09-12 13:14:46 +08:00
ychenfo 917d447605 nac3core: clean up, fix broken test 2021-09-09 02:09:35 +08:00
ychenfo f1013d9a17 nac3core: top level fix type var within list tuple, test of type var application compatibility 2021-09-09 02:03:44 +08:00
ychenfo 235b6e34d1 nac3core: top level derive fmt::Debug, fix dead lock 2021-09-07 00:20:40 +08:00
pca006132 173102fc56 codegen/expr: function codegen and refactoring 2021-08-25 15:29:58 +08:00
pca006132 1ffa1a8bb0 typecheck/typedef: added copy_from
This function would copy concrete type from one unifier to another
unifier, and can handle recursive types. This would be used in code
generation for moving types from one unification table to another one.
2021-08-25 12:02:10 +08:00
ychenfo 32773c14e0 move top level related things to a separate module 2021-08-24 17:19:17 +08:00
ychenfo 7b1fe36e90 formatted 2021-08-23 11:13:45 +08:00
pca006132 957ceb74e4 nac3core/typecheck: added basic location information 2021-08-21 14:51:46 +08:00
pca006132 3279f7a776 codegen for simple function call, and various fixes 2021-08-19 15:30:15 +08:00
ychenfo fa40fd73c6 formatted 2021-08-16 20:17:08 +08:00
ychenfo eb814dd8c3 clean unused use 2021-08-16 13:57:21 +08:00
ychenfo 3734663188 add RefCell to FunSignature in TypeEnum 2021-08-16 13:53:45 +08:00
pca006132 cb01c79603 removed Arc from TypeEnum 2021-08-13 13:33:59 +08:00
pca006132 1db8378f60 formatting 2021-08-12 16:36:23 +08:00
ychenfo 3a93e2b048 TypeEnum::TObj.param is now RefCell for interior mutability 2021-08-12 13:17:51 +08:00
pca006132 de8b67b605 refactored symbol resolver 2021-08-11 17:28:29 +08:00
pca006132 86ca02796b function parameter handling 2021-08-07 17:25:14 +08:00
pca006132 7a38ab3119 codegen for function call 2021-08-07 15:06:39 +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
pca006132 f00c1813e3 top-level related changes 2021-08-03 13:38:27 +08:00
pca006132 a3acf09bda typedef: make it send
Rc in calls is not send, so we use Arc instead.
2021-08-03 12:38:12 +08:00