We can work out what it should be since each case is supposed to have
the same type, so we can look ahead to the alternatives. This way, we
don't have to rely on the scrutinee alone to calculate the type of the
case block. (Idris 1 does this too but I've only just encountered the
need for it in Idris 2 now!)
Sorry for the less than informative title :). Lots going on here. It
started as an attempt to fix unification to deal with laziness coercions
in trickier places, but unearthed a couple of tricky and interconnected
issues that are hard to unpick into a single patch. So, this fixes a few
things:
- default hints should only be resolved on the current elaboration (e.g.
nested function definitions, not the outer definition which might not
yet be complete)
- delayed elaborators should be allowed to have nested delayed
elaborators, which means disambiguation is a little bit better
- we should delay elaborating arguments where the type isn't known yet,
because later arguments may resolve the type, and we can use this to
help with disambiguation/laziness coercions
- other bits and pieces arising
Record name and constructor are in the outer namespace, fields in the
nested namepsace. Private names in the nested namespace is visible from
the outer namespace. Fixes#183
Also remove the 'nested' flag on INamespace, since it was only there for
records, and not really the right way to do things. The nested namespace
name is now given in the IRecord constructor (a front end might not want
to use a new namespace after all).
They might match on runtime-erased things (which is okay, since they're
erased too!) and if we try building the tree, it'll report an error
incorrectly. Fixes#229
Check that none of the generated missing cases match explicitly given
clauses, which might happen if there's some overlaps in the clauses or
if there's some matching on implicits. Ignore erased argument positions
when checking the match.
If we postpone unification problems, it's not necessarily at the top
level of a term, but then if we retry and find we need to insert a
'Delay' or 'Force' then it had better be at the top level or we'll get
an incorrect term. So, keep track of this in postponed constraints.
For example, delayed elaborators. If it resolves one, and it's not a
complete solution, we might end up with unsolved holes. Or - possibly
worse - we might end up with an error in a program that is silently
fixed rather than reported!
Fixes#223
got the basic infrastructure to output syntax highlight in IDE mode
setup but the results are far from being usable, need more work to
understand how to reap information from Metadata
On some systems "/usr/bin" and "/usr/local/bin" are not used.
If CHEZ env variable is not defined, lookup for chez in the PATH if
defined. Otherwise falls back to the old behaviour. (ie. lookup in
"/usr/bin" and "/usr/local/bin" as a last resort)
These can give valuable information, but since they're not well typed,
we have to rebuild as close an approximation as we can before passing it
to the case tree compiler. We can do this in a type-directed way, but
ignoring whether any of the arguments are convertible, and not trying to
solve any of the implicits. If this fails, it doesn't use the impossible
case, otherwise it uses it to find the missing cases in the resulting
case tree.
This looks for an .ipkg file in a parent directory before loading the
given file, and loads it relative to the .ipkg's source directory, with
the options specified in the .ipkg.
The intention is to save all the editor modes having to do the same
thing, and especially makes it possible for the new vim mode to work
with ipkgs.
If the name is given (rather than, say, computed) update it so that it's
the data type name being defined - so ambiguities are resolved
immediately. Fixes#192
Pass through the types of the interface parameters to the top level
method types, because there might be information in there that we can't
otherwise infer. Fixes#188
This means we can say 'let x = foo' and have foo not be applied to its
implicit arguments, meaning that 'x' can be instantiated at whatever
implicits it needs through the scope.