Commit Graph

32 Commits

Author SHA1 Message Date
Niklas Larsson
b5a6637da8 Rename expected, input and run
Because cabal's wildcards are broken and doesn't allow
files without file endings.
2020-01-25 01:44:54 +01:00
Jason Felice
f743272eac Don't include '=' for RHS span 2017-12-07 10:18:08 -05:00
Jason Felice
79351ee7ae Add blank line after "large" messages 2017-12-07 10:18:07 -05:00
Jason Felice
7d0c06b108 Put source code before error (like parse errors) 2017-12-07 10:18:05 -05:00
Jason Felice
f967817d5b Make warnings, non-parse errors pretty 2017-12-07 10:18:02 -05:00
Jason Felice
b1a4264f7c Improve error message locations (#4210)
This contribution uses the strict WriterT transformer over our parser stack with a
monoid over FC and what used to be spanFC to compute the span of
non-terminal parsers from the spans of trackExtent-wrapped parsers.

The net result is that the locations reported for errors and warnings is
much improved. Most errors now report the extent of the error, rather than a
point roughly preceeding it (or after it, sometimes). There are still cases
where FCs are recomputed as a point after parsing--I didn't fix these, to cut
the scope of this PR--though all file locations produced during parsing use
the new, spanning parsing combinators.

I would start reading at Idris.Parser.Stack, then Idris.Parser.Helpers.

Overview:    
- *FC and non-*FC parsers (e.g. tokenFC and token, charLiteralFC and
    charLiteral, etc.) have been elided and the FC suffix removed. Any
    parser can be asked to report it's FC using the extent or withExtent
    combinators.
    
- Extents reported for errors end at the last character of the token, rather
    than on the following character.
 
- Now that all parsers can be queried for their spans, highlighting is
    done with the highlight parser combinator, e.g.
    highlight AnnQuasiquote (symbol "`{{" ...). These can be nested.
   
- Totality checking, in its current design, reports the extent of the first
    equation. This is a bit more misleading now that the span is computed
    correctly, since it could look like it's trying to indicate which clause is
    non-total. We should fix this (hopefully as a separate PR.)
   
- The span of clauses is actually the span of the right-hand side, and so this
    is reported when there is an error on the right-hand side or the left-hand
    side. We should also fix this (hopefully as a separate PR.)
    
- There's probably cases where, owning to the improved granularity, we will now
    notice errors were reported with FCs from the wrong object.
    I haven't tested an IDE-mode client yet. They may need to be patched if they
    are manually excluding the last character of tokens. Highlighting appears to
    work fine without changes, though.
2017-11-30 12:18:36 +01:00
Edwin Brady
58c3bb760a Hide more features behind %language pragmas
These are the features which should not be considered stable:
ElabReflection, DSLNotation, UniquenessTypes and FirstClassReflection,
in addition to the existing TypeProviders and ErrorReflection
2016-12-07 19:38:08 +00:00
(λ _ λ)
06d9db6de4 Use interface instead class or type class in documentations (#3379) 2016-09-02 15:18:25 +02:00
David Christiansen
f754d9c1b6 Purify Idris of "return"
* Deprecate "Monad.return" in favor of "pure"
* Update all included libraries to use "pure"
* Update internal code generation to remove "return"
* Remove unused AST constructor PReturn
* Update tests
2016-08-27 08:26:45 -04:00
gpyh
6db256a189 Fix formatting of some tests
Fix:
- missing $IDRIS
- missing/misplaced $@
- quotes around $@
2016-07-27 14:33:50 +02:00
Melvar Chen
8d78d3225f Add some Quotable implementations (#3104)
This adds Quotable implementations for every public datatype in Language.Reflection and Language.Reflection.Elab and for a couple of additional types which are returned by primitive Elab actions (namely Pair and Unit).
2016-04-10 19:56:25 +02:00
David Christiansen
0f00278f91 Generalize the types of mkApp and unApply
Now, they accept any Foldable and work for both the TT and Raw
representations.
2016-03-10 12:04:15 -05:00
David Raymond Christiansen
eaf5211f97 Add the ability to define datatypes in Elab
Add two new Elab effects:
 * declareDatatype, which adds the type constructor declaration to the
   context
 * defineDatatype, which adds the constructors to the datatype
2016-03-08 11:01:36 -05:00
Edwin Brady
be0ab25f42 Display totality errors on type check failure
Instead of only displaying them if there are no other errors, since
totality errors can be the cause of other errors.

Fixes #1437
2016-02-14 17:41:40 +00:00
Jan de Muijnck-Hughes
fd2501b677 Renamed DepPair to DPair 2016-02-08 14:38:35 +00:00
Jan de Muijnck-Hughes
ed2bda5e79 Updates to renaming dependent pairs.
+ Added deprecation warning for use of old name.
+ Updated tests to use new name.
+ Updated existing code to use new name.
2016-02-08 14:38:34 +00:00
David Raymond Christiansen
04f1d91ffb Update Agda-style reflection test with quoteGoal
Hygiene in quoted names makes this work as it should.
2016-01-29 11:18:22 -05:00
Niklas Larsson
b0e8b1258b make the tests respect the IDRIS env variable
Simplify the sandbox lookup and only run it once.

Only run the test script once for 'make test' instead of using the
makefile to iterate.
2016-01-22 06:57:04 +01:00
Edwin Brady
4d0a065f86 Change "class/instance" keywords
To "interface/implementation". Old syntax is still valid but gives a
deprecation warning.
2016-01-13 11:18:33 +00:00
David Raymond Christiansen
ac06ebb304 Disable the DecEq deriving test, due to slowness
Fixes #2785.
2015-11-27 18:00:43 +01:00
David Raymond Christiansen
58ddcd09bc Add derivation of DecEq to Pruviloj 2015-10-19 01:34:40 +02:00
Edwin Brady
83f0af13fb Display expected type of RHS in error messages
Also added %error_reverse annotations on IO so that IO related messages
are more readable. This improves the error in #2672.
2015-10-17 14:30:36 +01:00
David Raymond Christiansen
f7e1990ce4 Add lookup of FunArgs for global names to Elab
This makes it possible to write elaborators for term languages that use
Idris's plicity information. As a test of this, the test suite now
includes a mini-implementation of a subset of Agda's reflection using
Elab.
2015-10-16 18:55:24 +02:00
David Raymond Christiansen
5330e8a00c Simplifications to Elab
apply is simplified and forget has been moved to library code.
2015-10-16 01:24:38 +02:00
David Raymond Christiansen
83aa146947 Stop let-binding Elab scripts around their holes
This prevents them from showing up in intermediate elaboration states
and making things difficult to read.
2015-10-08 21:11:33 +02:00
David Raymond Christiansen
76bcaf2fa3 Add the ability to look up if a name is a TC to Elab
Now, Elab scripts can check whether a name denotes a type class.
2015-10-02 09:21:22 +02:00
David Raymond Christiansen
071d34b3fc Make name operations on PTerm quotation-aware
This fixes an obscure issue where certain do-bound names that did not
shadow, but were identical to, other do-bound names in different
subexpressions of one larger expression would fail when referred to in
antiquotations. Example:

    (do h <- gensym
        claim h a
        fill `(C1 ~(Var h)); solve) <|>
      (do h <- gensym
          claim h b
          fill `(C2 ~(Var h)); solve)

The second antiquoted h would throw a "No Such Variable" error, because
the second lambda-bound h was renamed at one point without its use site
being renamed similarly.
2015-09-18 23:20:02 +02:00
David Raymond Christiansen
a953ba2762 Update test for new API 2015-08-25 17:38:03 -07:00
David Raymond Christiansen
ff603967cc Make apply match internal behaviour
The second argument to apply is no longer ignored. This means that we
can now make use of Idris's features for solving implicits.
2015-06-15 19:34:09 +02:00
Edwin Brady
85a9d5063c Update error messages in tests 2015-05-31 21:22:36 +01:00
David Raymond Christiansen
f09605b3dd Require unique global names in TT
Fixes #2217 by demanding that global names in TT terms be
unambiguous. The elaborator will always produce them that way, but user
elab scripts might not, which led to confusion.

Also, disentagle 'apply' and 'fill'.
2015-04-30 12:40:36 +02:00
David Raymond Christiansen
28e2668206 Add reasonable tests for elaborator reflection 2015-04-23 23:18:44 +02:00