Commit Graph

23 Commits

Author SHA1 Message Date
Louis Gesbert
a56d95d790 Typing: add a "assume operator types" mode
This allows for retyping after monomorphisation: a new function just extracts
the return type of the operator, without checking the operand types.

Also to avoid multiplying function arguments around the typer, the flags have
been gathered in a record that is included in the typing environment; it's ok to
give them default values as long as these are the strictest.
2024-02-07 17:41:04 +01:00
Denis Merigoux
5310e47e5b
Fix monomorphization problems with [TAny] left 2024-01-17 16:03:20 +01:00
Louis Gesbert
2823795f9f AST change: more specific application
As part of making tuples first-class citizens, expliciting the arity upon
function application was needed (so that a function of two args can
transparently -- in the surface language -- be applied to either two arguments
or a pair).

It was decided to actually explicit the whole type of arguments because the cost
is the same, and this is consistent with lambda definitions.

A related change done here is the replacement of the `EOp` node for operators by
an "operator application" `EAppOp` node, enforcing a pervasive invariant that
operators are always directly applied. This makes matches terser, and highlights
the fact that the treatment of operator application is almost always different
from function application in practice.
2023-12-19 17:27:40 +01:00
Louis Gesbert
1ae955b504 Reformat 2023-11-30 23:53:38 +01:00
Louis Gesbert
3649f92975 Rework resolution of module elements
This changes the `decl_ctx` to be toplevel only, with flattened references to
uids for most elements. The module hierarchy, which is still useful in a few
places, is kept separately.

Module names are also changed to UIDs early on, and support for module aliases
has been added (needs testing).

This resolves some issues with lookup, and should be much more robust, as well
as more convenient for most lookups.

The `decl_ctx` was also extended for string ident lookups, which avoids having
to keep the desugared resolution structure available throughout the compilation
chain.
2023-11-30 21:14:12 +01:00
Louis Gesbert
c4715ea86e Reformat 2023-11-27 11:09:08 +01:00
Louis Gesbert
958aaebac3 Typing defaults fixes: keep in and out type in scope sigs 2023-11-27 11:06:16 +01:00
Louis Gesbert
544e18e110 Fixes related to environments and lookups 2023-08-31 18:31:48 +02:00
Louis Gesbert
72882f82df Reformat 2023-08-31 17:55:36 +02:00
Louis Gesbert
9bac045d03 Implement module lookups for scopes, structs, and enums 2023-08-31 17:54:39 +02:00
Louis Gesbert
ec97c386c3 Reformat + regen 2023-06-15 17:57:01 +02:00
Louis Gesbert
26c75af2ae Allow declaration of toplevel values without definition 2023-06-15 17:57:01 +02:00
Denis Merigoux
8d7666ee92
Interleave assertions with rules from desugared to scopelang 2023-04-28 14:15:43 +02:00
Denis Merigoux
57da622567
Refactoring changes after @altgr's suggestions 2023-04-18 10:31:44 +02:00
Denis Merigoux
aa8ab3be3d
Merge branch 'master' into c_backend 2023-03-21 12:14:10 +01:00
Louis Gesbert
fc5910e093 Fix multi-argument scopedefs, improve error message positions
This adds a few positions to the parser, and tweaks some others, vastly
improving the reporting of some errors (inconsistent functions definitions, but
also exceptions cycles, etc.)
2023-02-28 15:53:50 +01:00
adelaett
9f31715a47 style 2023-02-22 12:11:42 +01:00
adelaett
e519b7f146 until desugared 2023-02-20 17:21:44 +01:00
Louis Gesbert
c3af0b4097 Toplevel definitions: branch cleanup
- fix remaining warnings (mostly unused arguments)
- renamings throughout for consistency and clarity
2023-02-13 18:02:09 +01:00
Louis Gesbert
d66cd1e29c Toplevel defs: tests & fixes 2023-02-13 11:44:32 +01:00
Denis Merigoux
d7df6b3e80
Typing now takes into account [TAny] in structs/enums 2023-02-08 16:00:53 +01:00
Denis Merigoux
c78a004b53
Leave everything unresolved for now 2023-02-08 16:00:53 +01:00
Louis Gesbert
8960e5dbbc Add typing-based disambiguation pass after desugaring
Some typing errors are changed a little, because they get triggered during the
typing of the disambiguation pass, which does not specify the expected return
type (it's an expected invariant that it should not be needed for
disambiguation).

It would be possible to still specify these types during disambiguation just to
get the same errors, but since the newer ones don't appear to be clearly worse
at the moment, it has not been done.
2022-11-28 16:38:09 +01:00