Commit Graph

245 Commits

Author SHA1 Message Date
Arnaud Bailly
75b04d867b first stab at syntax highlightin in Emacs
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
2020-02-29 13:47:27 +01:00
Edwin Brady
8f583ca900
Merge pull request #189 from chrrasmussen/fix-ide-mode-backwards-compatibility
Fix IDE Mode for Atom
2020-02-27 10:38:36 +00:00
Edwin Brady
1bb028ae47 Update proof tutorial for Idris 2 2020-02-26 12:33:01 +00:00
Edwin Brady
16ae7994e7 More documentation refreshing 2020-02-25 22:18:02 +00:00
Edwin Brady
2a2a20849d Add default implicit arguments
These are part of the core QTT now, so any substitutions or dependencies
will be dealt with as they should.
2020-02-25 14:09:08 +00:00
Edwin Brady
2da8da8aa9 Add missing test file 2020-02-23 22:20:11 +00:00
Edwin Brady
57a14ff401 Coverage checker looks at 'impossible' clauses
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.
2020-02-23 21:40:23 +00:00
Edwin Brady
cd972143a5 Also check unique locals inside pairs
The error message doesn't propagate nicely here yet, but it should still
report failure to resolve the search
2020-02-23 17:44:18 +00:00
Edwin Brady
11da440124 Ambiguity checking on locals in auto search
Fixes #160
2020-02-23 17:30:48 +00:00
Edwin Brady
654ab0cbd0 Look inside definitions during conversion
If two definitions are identical, with the same arguments, they should
convert, even if they have different names. Fixes #194
2020-02-23 15:58:14 +00:00
Edwin Brady
e126dcd28f Add --find-ipkg flag
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.
2020-02-22 23:25:02 +00:00
Edwin Brady
8158c617f6 Disambiguate data constuctor families
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
2020-02-22 19:32:22 +00:00
Edwin Brady
5c86552e56 Parse primitive types as identifiers
This way we can use them as parts of namespaces - they don't need to be
reserved keywords, just reserved names. Fixes #111
2020-02-22 18:36:46 +00:00
Edwin Brady
03bdc3145c Type of generated top level methods
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
2020-02-22 17:38:13 +00:00
Edwin Brady
22a779bc88 Proof search on solved holes shows result
From the result of unification
2020-02-22 15:30:45 +00:00
Edwin Brady
fb49038c9f Don't automatically apply implicits in let
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.
2020-02-16 16:33:17 +00:00
Edwin Brady
84faedba50 Tweak expression search heuristic
Search locals left to right, so that they are used as arguments in the
same order by default in recursive calls.
2020-02-15 23:24:00 +00:00
Edwin Brady
14e9872f07 Don't show MN names in hole contexts
This prevents display of shadowed names from case blocks/where clauses
that are now unusable. It does mean that constraint arguments aren't
displayed, unless given an explicit name - this may not be good, since
we might want to know which constraints are in scope, so it may yet need
a little tweaking.
2020-02-15 22:33:13 +00:00
Edwin Brady
3fe5c78f86 Conversion checking of case blocks
This is a little bit of a hack, but is for the situation where a case
block arises from the same bit of source but with a different name,
which would happen when elaborating interfaces with cases in a method
signature. If it's the same function with the same scrutinee, it's
convertible.
Fixes #191
2020-02-13 18:26:37 +00:00
Edwin Brady
6267231649 Cut down default search depth
If it's not going to find an auto implicit by then, it never will, and
we'll just take ages to get an error
2020-02-13 18:23:40 +00:00
Edwin Brady
666373e9db Implement 'using' notation
See test idris2/basic035; implicitly binds an auto-implicit for
interfaces if no name is given, or an implicit argument if a name is
given.
2020-02-11 17:27:04 +00:00
Edwin Brady
9fd2e428ad Check import hashes before a full parse
This needed a bit of reorganisation, but it speeds up checking if a
module doesn't need rebuilding due to the import interfaces not
changing. Also it means that the "Type checking foo.idr" message is
displayed before parsing rather than after, which is probably better.
2020-02-10 15:47:19 +00:00
Edwin Brady
413d09dad8 Unification tweak for getting lambda types
We've been generalising inferred function types to have multiplicity
RigW but sometimes (especially on lambdas) we need to infer the precise
type, so make a distinction.
This is pretty ugly, really. It would be better to be able to postpone
the choice until we know more, but it's not obvious to me how to achieve
that with the way unification is currently set up. The present way at
least works fine with code that doesn't use linearity, which is the
right default I think!
2020-02-09 17:05:22 +00:00
Edwin Brady
722131f7d0 Simpler implementation of 'case'
Now only abstracts over the environment once and deals with 'where'
clauses by rewriting the nested name with the rearranged environment. As
a result, it interacts far better with local definitions (i.e. where
blocks).
2020-02-09 13:46:58 +00:00
Edwin Brady
4fed357fb4 Allow type annotations on lets
Fixes #87
2020-02-01 12:17:54 +00:00
Christian Rasmussen
3a436061ca Fix IDE Mode for Atom 2020-01-31 19:21:42 +01:00
Edwin Brady
2465e5a149 Some buffer updates
Initialising buffers from files, error checking on creation, resizing.
2020-01-31 16:49:31 +00:00
Edwin Brady
e69c1529d9 Bitwise operators 2020-01-31 16:25:19 +00:00
Edwin Brady
bb6cefc0a9 Added Data.IOArray
plus scheme primitives for runtime, via vectors
2020-01-30 17:04:33 +00:00
Edwin Brady
6f9cca6ce3 Change inference of function types in unification
Always infer a multiplicity of W. Since we can pass a linear function to
one which expects an unrestricted argument, this gives the more general
result if the multiplicity is otherwise unknown.
This makes things like 'maybe id (+) x y' type check again even in the
presence of an 'id' which is declared linear!
2020-01-27 17:54:21 +00:00
Edwin Brady
c725d37488 Add %unbound_implicits directive
This is the same as %auto_implicits in Idris 1, but with a more
appropriate name, because auto implicits are something else.
'%unbound_implicits off' turns off implicit forall bindings. See test
basic033 for an example.
2020-01-27 17:31:53 +00:00
Edwin Brady
3cb574102a Add idiom brackets 2020-01-26 17:24:25 +00:00
Edwin Brady
1da3af5b2a Add ! notation
In a small change from Idris 1, this lifts to the nearest binder or
block, so doesn't lift past an explicit "do" in particular. Blocks are:
- case branches
- if branches
- scope of local function definitions, or any binder
- do blocks
2020-01-26 16:52:25 +00:00
Edwin Brady
04e4ebf80e Better approach to erasure in pattern matching
It's a big patch, but the summary is that it's okay to use a pattern in
an erased position if either:

- the pattern can also be solved by unification (this is the same as
  'dot patterns' for matching on non-constructor forms)
- the argument position is detaggable w.r.t. non-erased arguments, which
  means we can tell which pattern it is without pattern matching

The second case, in particular, means we can still pattern match on
proof terms which turn out to be irrelevant, especially Refl.

Fixes #178
2020-01-21 18:47:43 +00:00
Edwin Brady
af9e920d74 Merge branch 'linearity-clean' of https://github.com/ohad/Idris2 into ohad-linearity-clean 2020-01-19 16:56:13 +00:00
Edwin Brady
ea8c22135c
Merge pull request #156 from clayrat/misc-fixes
Misc fixes and additions
2020-01-19 16:48:47 +00:00
Edwin Brady
a275b57a81
Merge pull request #154 from abailly/better-ide-mode
Improve IDE mode to provide basic Emacs mode interaction
2020-01-19 16:47:18 +00:00
Alex Gryzlov
ce15b48a78 Merge remote-tracking branch 'upstream/master' into misc-fixes 2020-01-15 22:52:38 +01:00
Edwin Brady
751fd1f36a Experiment with hole name display
If unelaborating a term that's just a hole, show the scope it was
created in too, to help with error messages
2020-01-11 23:34:44 +00:00
Edwin Brady
4ce469cc03 Name choice of holes
The names should give more of a hint as to where the holes were created.
Might help with #161.
2020-01-11 22:52:18 +00:00
Edwin Brady
abd801c45a
Merge pull request #177 from SPY/testfix/chez010-macos
Fix chez010 test on MacOS
2020-01-11 22:50:16 +00:00
Edwin Brady
da293d1ce8 Check constructors are fully applied in case trees
This is necessary to build case trees correctly, and without this, we
can get mysterious and hard to debug run time errors!
2020-01-11 17:27:27 +00:00
Arnaud Bailly
432cc7ca5c Merge branch 'master' of https://github.com/edwinb/Idris2 into better-ide-mode 2020-01-11 09:45:39 +01:00
Ilya Rezvov
32b1c9b34f use an explicit extension for libcb references in %foreign pragmas 2020-01-09 11:55:33 -08:00
Ilya Rezvov
56d24e34d4 Merge remote-tracking branch 'origin/master' into testfix/chez010-macos 2020-01-09 11:44:51 -08:00
Ohad Kammar
971bfc5bbd Update prelude line numbers in a test 2020-01-09 13:06:39 +00:00
Edwin Brady
7cde0a7255
Merge pull request #174 from chrrasmussen/fix-double-subtraction
Fix subtraction of Double in interpreter
2020-01-09 11:41:40 +00:00
Edwin Brady
4b79b98db4
Merge pull request #173 from timmyjose/fix-mit-scheme-build-issues
Reorder Scheme compilers order to pick generic Scheme last.
2020-01-09 11:39:39 +00:00
Ilya Rezvov
b437323fd2 dylib extension added for libcb to fix chez010 test on MacOS 2020-01-01 14:23:02 -08:00
Edwin Brady
bf5b2298e0 Update test chez010
To use expressions to calculate FFI convention, so that it's tested.
2019-12-30 21:16:07 +00:00