Age | Commit message (Collapse) | Author |
|
Previously, the identifier with the same name in two disjunctive
patterns (aka or-patterns) must be bound to the exactly same location.
For instance,
(x, _) || (x, _) /* ok */
(_, y) || (_, y) /* ok */
(x, _) || (_, x) /* not ok */
In certain Standard ML implementations, it's allowed to write a pattern like
(x, _) || (_, x)
where x is bound to different locations as long as they have the same type.
This patch removes the restriction.
Signed-off-by: Mura Li <mural@ctli.io>
|
|
|
|
|
|
|
|
Tests 001 through 003 are specific errors, and 004 through 006 are
batches of blanket fuzzing that uncovered at least one error each. The
blanket fuzzers test function calls between all combinations of
{myrddin, c} and {myrddin, c}, except for c functions calling c
functions.
|
|
This allows tests consisting of multiple files, including .glue.c files,
so we can check calling convention compliance.
|
|
This only appears to come into play when trying to match memory layout
of tuples with structs, or when accessing deeply nested tuples.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This makes our gitignore nicer.
|
|
This reverts commit beab0276a94c684f938ae5ea3d2c29c3dc331386.
|
|
Funcs can go inside funcs.
|
|
This patch adds tuple access expressions. If t is a tuple, its
N-th component can be retrieved with the syntax t.N. Of course,
the components are zero indexed. I believe the code also works
if 't' is a pointer to a tuple (but I have not checked this).
|
|
|
|
We were overly aggressive in unifying wildcards.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Summary:
--------
During the Myrcon in September Ori suggested an 'auto' operator
that would evaluate what it applies to, store the result in a
temporary t, and call __dispose__(t) when the current block exits.
This patch implements this idea under the form of a unary
operator. This, for instance, allows to have:
impl disposable regex# =
__dispose__ = {r; regex.free(r)}
;;
regex.exec(auto std.try(regex.compile("f..bar")), "foobar")
Like before, it is guaranteed that __dispose__ is called in
reverse order of auto appearance.
Backward compatibility:
-----------------------
Nope. Auto variables are now gone. This should not be a problem,
simply rewrite:
var auto x = foo()
into:
var x = auto foo()
Implementation:
---------------
It largely reuses the code I had written for 'auto' variables
but needs a little finer grain tracking because we don't always
want to call __dispose__ for *all* auto expression results when
leaving a block (some might not be evaluated yet).
For example:
auto 1
if b
-> void
;;
auto 2
Only __dispose__(1) must be called when '-> void' is executed.
If the block falls through, __dispose__(2) and __dispose__(1)
will be called in sequence.
TODO:
-----
- Err when goto jumps in/out of a block that has auto
expressions.
- Support auto in patterns.
match ...
| `std.Some (auto x): ...
is essentially rewritten to:
match ...
| `std.Some (auto x):
auto x
...
- Test edge cases (e.g., auto in loop condition)
Actually, test.
Cheers,
|
|
|
|
|
|
Fixes #159
|
|
Also fix some whitespace.
|
|
|
|
Thanks to https://github.com/Earnestly
|
|
Outdated since 26fef326df.
|
|
|
|
|
|
|
|
|
|
This should clear the way for better deduplication.
|
|
|
|
|
|
It's a tad stricter about a couple of things.
|
|
The winds of change are a-blowin.
|
|
|
|
This allows multiple specializations of a declarations with a concrete type,
which can be selected with the new impl expression if it can't be deduced by its
type alone.
For example
trait hasname @t =
Name: byte[:]
;;
impl hasname void =
Name = "somename"
;;
impl hasname bool =
Name = "othername"
;;
const boolname = impl(Name, void)
To do this, pass the param type through to genericname and specializedcl. Since
we now need the type parameter to look up trait decls, make sure n->expr.param
gets the necessary treatment in typesub, specializenode, pickle, and unpickle.
We also need to tag the param types for export.
|