lean4-htt/tests/pkg
Robert J. Simmons 3a309ba4eb
feat: improve error message in the case of type class synthesis failure (#11245)
This PR improves the error message encountered in the case of a type
class instance resolution failure, and adds an error explanation that
discusses the common new-user case of binary operation overloading and
points to the `trace.Meta.synthInstance` option for advanced debugging.

## Example

```lean4
def f (x : String) := x + x
```

Before:
```
failed to synthesize
  HAdd String String ?m.5

Hint: Additional diagnostic information may be available using the `set_option diagnostics true` command.
```

After:
```
failed to synthesize instance of type class
  HAdd String String ?m.5

Hint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.
Error code: lean.failedToSynthesizeTypeclassInstance
[View explanation](https://lean-lang.org/doc/reference/latest/find/?domain=Manual.errorExplanation&name=lean.failedToSynthesizeTypeclassInstance)
```

The error message is changed in three important ways:
* Explains *what* failed to synthesize, using the "type class"
terminology that's more likely to be recognized than the "instance"
terminology
* Points to the `trace.Meta.synthInstance` option which is otherwise
nearly undiscoverable but is quite powerful (see also
leanprover/reference-manual#663 which is adding commentary on this
option)
* Gives an error explanation link (which won't actually work until the
next release after this is merged) which prioritizes the common-case
explanation of using the wrong binary operation
2025-11-21 21:24:27 +00:00
..
builtin_attr refactor: update built-in tactic error messages (#9633) 2025-07-31 14:16:57 +00:00
debug feat: debug_assert! (#7256) 2025-03-03 16:34:44 +00:00
def_clash fix: symbol clashes between packages (#11082) 2025-11-19 02:24:44 +00:00
deriving chore: update tests to account for .lake 2023-11-13 20:31:24 -05:00
frontend chore: re-enable tests (#10923) 2025-10-23 08:38:57 +00:00
initialize fix: missing unboxing in interpreter when loading initialized value (#4512) 2024-06-20 10:06:24 +00:00
linter_set feat: implement "linter sets" that can be turned on as a group (#8106) 2025-05-14 23:30:42 +00:00
misc fix: local syntax should create private definitions 2025-08-19 14:49:12 -07:00
mod_clash test: module clash across packages (#11246) 2025-11-19 02:23:34 +00:00
module feat: improve error message in the case of type class synthesis failure (#11245) 2025-11-21 21:24:27 +00:00
path with spaces fix: calling programs with spaces on Windows (#4515) 2024-07-26 17:35:05 +00:00
prv feat: improve error message in the case of type class synthesis failure (#11245) 2025-11-21 21:24:27 +00:00
rebuild refactor: lake: mv tests/examples to top-level tests dir (#10688) 2025-10-06 21:47:57 +00:00
setup feat: server support for new module setup (#8699) 2025-06-23 18:00:14 +00:00
signal feat: add signal handling support using libuv (#9258) 2025-09-15 13:09:50 +00:00
structure_docstrings feat: link docstrings for diamond inheritance (#11122) 2025-11-10 01:05:01 +00:00
test_extern test: disable flaky test 2025-04-29 17:34:10 +02:00
user_attr chore: upstream Nat material from mathlib (#7971) 2025-04-16 06:55:32 +00:00
user_attr_app chore: re-enable tests (#10923) 2025-10-23 08:38:57 +00:00
user_ext chore: disable nondeterministic test 2025-04-24 11:30:26 +02:00
user_opt feat: accept user-defined options on the cmdline (#4741) 2024-08-02 12:24:56 +00:00
user_plugin fix: symbol clashes between packages (#11082) 2025-11-19 02:24:44 +00:00
ver_clash test: version clash w/ diamond deps (#11155) 2025-11-13 05:40:56 +00:00
.gitignore test: module clash across packages (#11246) 2025-11-19 02:23:34 +00:00