aboutsummaryrefslogtreecommitdiff
path: root/interp/constrintern.ml
AgeCommit message (Collapse)Author
2020-07-02Fix record pattern interpretation with implicit argumentsGaëtan Gilbert
We interpret `{|proj=pat|}` as `@C _ pat` instead of `C _ pat` (where the `_` stands for the parameters). Fix #12534
2020-05-15[interp] Register printers for InternalizationError instead of ad-hoc hanlding.Emilio Jesus Gallego Arias
2020-05-15[misc] Better preserve backtraces in several modulesEmilio Jesus Gallego Arias
Re-raising inside exception handlers must be done with care in order to preserve backtraces; even if newer OCaml versions do a better job in automatically spilling `%reraise` in places that matter, there is no guarantee for that to happen. I've done a best-effort pass of places that were re-raising incorrectly, hopefully I got the logic right. There is the special case of `Nametab.error_global_not_found` which is raised many times in response to a `Not_found` error; IMHO this error should be converted to something more specific, however the scope of that change would be huge as to do easily...
2020-05-14Merge PR #11922: No more local reduction functions in Reductionops.Maxime Dénès
Reviewed-by: Matafou Ack-by: SkySkimmer Reviewed-by: gares
2020-05-13Extending support for mixing binders and terms in abbreviations.Hugo Herbelin
2020-05-10No more local reduction functions in Reductionops.Pierre-Marie Pédrot
This is extracted from #9710, where we need the environment anyway to compute iota rules on inductive types with let-bindings. The commit is self-contained, so I think it could go directly in to save me a few rebases. Furthermore, this is also related to #11707. Assuming we split cbn from the other reduction machine, this allows to merge the "local" machine with the general one, since after this PR they will have the same type. One less reduction machine should make people happy.
2020-04-21Fixing #3451: coqdoc links for projections of tuples rather than for ↵Hugo Herbelin
constructor. Moreover, the link to the constructor was hiding other contents of the tuple.
2020-04-21Constrintern: another reworking of the interning of records.Hugo Herbelin
This allows to have the "No local fields allowed in a record construction" error applicable to all fields and not only the first one. Formerly, this was wrongly raising an error "This record contains fields of both T and T".
2020-04-21Constrintern.ml: simplifying the interning of record tuples.Hugo Herbelin
We basically avoid a detour via intern_applied_reference. In particular, this stops dumpglobbing the name of the "constructor" of the record which in practice does not appear in the source.
2020-04-15Coqdoc: Exporting location and unique id for binding variables.Hugo Herbelin
This provides linking, appropriate coloring and appropriate hovering in coqdoc documents. In particular, this fixes #7697.
2020-04-15Making type interning_data abstract in constrintern.ml.Hugo Herbelin
2020-04-15Small convenient code factorization in constrintern.ml.Hugo Herbelin
No change of semantics.
2020-04-13Close #11935: section variables do not have universe instances.Gaëtan Gilbert
2020-03-31Remove check_hidden_implicit_parameters (not needed anymore)Gaëtan Gilbert
2020-03-31Remove special case for implicit inductive parametersMaxime Dénès
Co-authored-by: Jasper Hugunin <jasper@hugunin.net> Co-authored-by: Gaëtan Gilbert <gaetan.gilbert@skyskimmer.net>
2020-03-22Centralizing all kinds of numeral string management in numTok.ml.Hugo Herbelin
Four types of numerals are introduced: - positive natural numbers (may include "_", e.g. to separate thousands, and leading 0) - integer numbers (may start with a minus sign) - positive numbers with mantisse and signed exponent - signed numbers with mantisse and signed exponent In passing, we clarify that the lexer parses only positive numerals, but the numeral interpreters may accept signed numerals. Several improvements and fixes come from Pierre Roux. See https://github.com/coq/coq/pull/11703 for details. Thanks to him.
2020-03-18Update headers in the whole code base.Théo Zimmermann
Add headers to a few files which were missing them.
2020-02-25Fixing residual bug of #11120.Hugo Herbelin
On the principle that a notation to a constant inherits the implicit arguments of the constant, a non-applied notation should inherit its next maximal implicit arguments.
2020-02-22Fixes #4690: do not allow @f in notations when f is a notation variable.Hugo Herbelin
2020-02-22Inherit arguments scopes in pattern notations bound to some @id.Hugo Herbelin
2020-02-22Inherit scopes and implicit sign. in notations for partially applied pattern.Hugo Herbelin
Exception: when the notation is to some @id. Formerly, this was ignored for all kinds of string notations.
2020-02-22Inherit argument scopes in notations to expressions of the form @f.Hugo Herbelin
This is a change of semantics.
2020-02-22Propagate implicit arguments in all notations for partial applications.Hugo Herbelin
This was done for abbreviations but not string notations. This adopts the policy proposed in #11091 to make parsing and printing consistent.
2020-02-19Addressing #6082 and #7766 (overriding format of notation).Hugo Herbelin
We do two changes: - We distinguish between a notion of format generically attached to notations and a new notion of format attached to interpreted notations. "Reserved Notation" attaches a format generically. "Notation" attaches the format specifically to the given interpretation, and additionally, attaches it generically if it is the first time the notation is defined. - We warn before overriding an explicitly reserved generic format, or a specific format.
2020-02-12Remove Goptions.opt_name fieldGaëtan Gilbert
The standard use is to repeat the option keywords in lowercase, which is basically useless. En passant add doc entry for Dump Arith.
2020-02-11Fixing some residual bugs of PR #10202 (manual implicit args in subterms).Hugo Herbelin
- Implicit arguments in the return clause and in the branches of a match were not checked. - Implicit arguments in each declaration of intern_context were not restarted. - Additionally, in intern_context, we take into account ids from the env on top of which intern_context is called. - A better approximation of the check for manual implicit in notations improved (though not fully correct because the exact context of interpretation of a binder in a notation with recursive binders is not known). We also rename impl_binder_index into binder_block_names in anticipation of checking redundancies also for non-implicit arguments.
2020-02-11Reinforcing the role of type "typing_constraint".Hugo Herbelin
WithoutTypeConstraint says it can be a term. In particular, if it has manual implicit arguments, these will be allowed only in leading lambdas. I.e. it can start with "fun {x}" but not with "forall {x}". New constructor UnknownIfTermOrType allows to be both a term or a type. In particular, if it allowed start both with "fun {x}" and "forall {x}".
2020-02-04Correct bug in non max local implicit argumentsSimonBoulier
+ tests in the test-suite for non max local implicit arguments
2020-02-04Add syntax for non maximally inserted implicit argumentsSimonBoulier
2020-01-30Minor indentation change.Hugo Herbelin
2019-12-04Manual implicit arguments: more robustness tests.Hugo Herbelin
- Warn in some places where {x:T} is not assumed to occur (e.g. in argument of an application, or of a match). - Warn when an implicit argument occurs several times with the same name. - Accept local anonymous {_:T} with explicitation possible using name `arg_k`. We obtain this by using a flag (impl_binder_index) which tells if we are in a position where implicit arguments matter and, if yes, the index of the next binder.
2019-12-04Impargs: Using ExplByPos/ExplByName rather than encoding index as an ident.Hugo Herbelin
This moves the encoding of "n" as "arg_n" closer to the user interface level. Note however that Constrintern.build_impl is not able yet to use ExplByPos. See further commits.
2019-11-21Merge PR #11132: Fixing bugs in the computation of implicit arguments for ↵Emilio Jesus Gallego Arias
`Fixpoint` with a let binder Reviewed-by: Zimmi48 Reviewed-by: ejgallego
2019-11-21[coq] Untabify the whole ML codebase.Emilio Jesus Gallego Arias
We also remove trailing whitespace. Script used: ```bash for i in `find . -name '*.ml' -or -name '*.mli' -or -name '*.mlg'`; do expand -i "$i" | sponge "$i"; sed -e's/[[:space:]]*$//' -i.bak "$i"; done ```
2019-11-19Fixing bugs in the computation of implicit arguments for fix with a let binder.Hugo Herbelin
2019-08-19[api] Move handling of variable implicit data to impargsEmilio Jesus Gallego Arias
We move `binder_kind` to the pretyping AST, removing the last data type in the now orphaned file `Decl_kinds`. This seems a better fit, as this data is not relevant to the lower layers but only used in `Impargs`. We also move state keeping to `Impargs`, so now implicit declaration must include the type. We also remove a duplicated function.
2019-07-08[api] Deprecate GlobRef constructors.Emilio Jesus Gallego Arias
Not pretty, but it had to be done some day, as `Globnames` seems to be on the way out. I have taken the opportunity to reduce the number of `open` in the codebase. The qualified style would indeed allow us to use a bit nicer names `GlobRef.Inductive` instead of `IndRef`, etc... once we have the tooling to do large-scale refactoring that could be tried.
2019-07-03Move variable_secpath logic to dumpglob from constrinternGaëtan Gilbert
2019-07-03Remove constrintern global_level dead codeGaëtan Gilbert
Not sure what this was for.
2019-06-18Merge PR #10199: Fix computation of implicit arguments when names collide in ↵Maxime Dénès
local fix/cofix (#10197) Reviewed-by: maximedenes
2019-06-17Update ml-style headers to new year.Théo Zimmermann
2019-06-17Merge PR #10226: Simplify implicit_quantifiersEmilio Jesus Gallego Arias
Reviewed-by: herbelin
2019-06-16Turning "manual_implicits" into a list of position in impargs.ml.Hugo Herbelin
2019-06-16Adding location in warning telling implicit arguments differ in term and type.Hugo Herbelin
2019-06-11Fix #10225 (Instance := {} accepts duplicate fields)Gaëtan Gilbert
This replaces the mismatched context error, which occurred when Instance := {} was used with strictly more fields than declared. Since we later check that field names match those declared for the instance, now that we reject duplicates we know that there are no extra fields.
2019-06-11Simplify implicit_quantifiersGaëtan Gilbert
After removing `Instance : !type` implicit_application is only used in constrintern. We propagate constant arguments ?allow_partial and combine_params_freevar. Also remove unused functions.
2019-06-01Allowing Set to be part of universe expressions.Hugo Herbelin
Conversely, Type existential variables now (explicitly) cover the Set case. Similarly for Prop and SProp.
2019-06-01Towards unifying parsing/printing for universe instances and Type's argument.Hugo Herbelin
We consistently use: - UUnknown: to mean a rigid anonymous universe (written Type in instances and Type as a sort) [was formerly encoded as [] in Type's argument] - UAnonymous: to mean a flexible anonymous universe (written _ in instances and Type@{_} as a sort) [was formerly encoded as [None] in Type's argument] - UNamed: to mean a named universe or universe expression (written id or qualid in instances and Type@{id} or Type@{qualid} or more generally Type@{id+n}, Type@{qualid+n}, Type@{max(...)} as a sort) There is a little change of syntax: "_" in a "max" list of universes (e.g. "Type@{max(_,id+1)}" is not anymore allowed. But it was trivially satisfiable by unifying the flexible universe with a neighbor of the list and the syntax is anyway not documented. There is a little change of semantics: if I do id@{Type} for an abbreviation "id := Type", it will consider a rigid variable rather than a flexible variable as before.
2019-05-23do not parse `|` as infix in patterns; parse `|}` as `|` `}`Georges Gonthier
* use mixfix `(p1 | … | pn)` notation for nested disjunctive patterns, rather than infix `|`, making pattern syntax consistent with term syntax. * disable extending `pattern` grammar with notation incompatible with the nested disjunctive pattern syntax `(p1 | … | pn)`, such as the `(p | q)` divisibility notation used by `Numbers`. * emit a (disabled by default) `disj-pattern-notation` warning when such `Notation` is attempted. * update documentation accordingly; document incompatibilities in `changelog`. * comment special treatment of `(num)` in grammar. * update file extensions in `Pcoq` header comment. * correct the keyword declarations to reflect the contents of the grammar files; perhaps there should be an option to disable implicit keyword extension in a `.mlg` file, so that these lists could actually be checked. * parse the `|}` manifest record terminator as `|` followed by `}`, eliminating the `|}` token which conflicts with notations that use `|` as a terminator (such as, absolute value, norm, or cardinal in MathComp). Since `|` is now an `operconstr` _and_ `pattern` terminator, `bar_cbrace` rule checks for contiguous symbols, this change entails no visible behaviour change.
2019-05-23Fixing typos - Part 2JPR