lean4-htt/tests/lean/run
Leonardo de Moura 9af0a0e18b feat: add withReader method
@Kha `withReader` is a well-behaved version of `adaptReader`. `adaptReader` is
too general, and it often produces counterintuitive elaboration
errors.

Here are two super annoying issues I hit all the time:
1- `adaptReader` + polymorphic code
```
def ex1 : ReaderT Nat IO Unit :=
adaptReader (fun x => x + 1) $
  IO.println "foo" -- 3 Errors here failed to synthesize `Monad ?m` and  `MonadIO ?m`, and don't know how to synthesize `Type → Type`
```

2- `adaptReader` and notation that requires the expected type
```
structure Context :=
(x y : Nat)

def ex2 : ReaderT Context IO Nat :=
adaptReader (fun s => { s with x := 10 }) $ -- Error at the structure instance
  ...
```
In the example above, I have to write `fun (s : Context) => ...` to
fix the problem.

The two problems above happen in the old and new frontends. However,
there is a new problem specific for the new frontend. In the new
frontend, a `do` is only elaborated when the expected type is known.
So, `adaptReader (fun ctx => ...) do ...` seldom works :(

As I said above, the issue is that `adaptReader` is too general. Its
type is
```
  {ρ ρ' : Type u_1} → {m m' : Type u_1 → Type u_2} → [MonadReaderAdapter ρ ρ' m m'] → {α : Type u_1} → (ρ' → ρ) → m α → m' α
```

`withReader` is a simpler version of `adaptReader`
```
withReader : {ρ : Type u_1} → {m : Type u_1 → Type u_2} → [MonadWithReader ρ m] → {α : Type u_1} → (ρ → ρ) → m α → m α
```
It doesn't have any of the problems above. Moreover, I managed to replace
every single instance of `adaptReader` with `withReader` at the stdlib
and tests. We don't need the `adaptReader` generality.
2020-10-13 15:00:17 -07:00
..
.gitignore chore: ignore more test output files 2020-05-14 14:38:52 +02:00
28.lean chore: add temporary workarounds 2020-09-30 07:05:46 -07:00
29.lean test: issue 29 2020-09-23 18:30:28 -07:00
34.lean chore: moving tests to new frontend 2020-09-10 18:00:34 -07:00
108.lean
111.lean chore: fix tests 2020-05-26 15:05:01 -07:00
121.lean chore: moving tests to new frontend 2020-09-10 18:00:34 -07:00
125.lean test: string interpolation 2020-10-09 17:02:12 -07:00
175.lean fix: fixes #175 2020-09-21 17:12:07 -07:00
1954.lean chore: moving tests to new frontend 2020-09-10 18:00:34 -07:00
1968.lean chore: moving tests to new frontend 2020-09-10 18:00:34 -07:00
anonymous_ctor_error_msg.lean test: new frontend tests 2020-10-09 18:21:45 -07:00
array1.lean chore: add temporary workarounds 2020-09-30 07:05:46 -07:00
autoparam.lean
backtrackable_estate.lean chore: moving tests to new frontend 2020-09-10 18:00:34 -07:00
bigmul.lean chore: moving tests to new frontend 2020-09-10 18:00:34 -07:00
bigop.lean chore: remove Monad List instance 2020-10-05 13:27:18 -07:00
borrowBug.lean test: new frontend tests 2020-10-09 18:21:45 -07:00
catchThe.lean feat: add string interpolation for MessageData 2020-10-09 20:43:26 -07:00
cdotTests.lean test: cdot tests 2020-09-25 18:48:23 -07:00
check.lean chore: moving tests to new frontend 2020-09-10 18:00:34 -07:00
choiceExpectedTypeBug.lean test: new frontend tests 2020-10-09 18:21:45 -07:00
choiceMacroRules.lean chore: fix test 2020-06-08 16:13:52 -07:00
closure1.lean feat: add string interpolation for MessageData 2020-10-09 20:43:26 -07:00
coeIssue1.lean chore: moving tests to new frontend 2020-09-10 18:00:34 -07:00
coeIssue2.lean chore: moving tests to new frontend 2020-09-10 18:00:34 -07:00
coeIssue3.lean chore: moving tests to new frontend 2020-09-10 18:00:34 -07:00
coeIssues4.lean fix: tests and elabDo 2020-09-26 19:12:01 -07:00
coelambda.lean fix: ensure expectedType at fun body 2020-09-13 13:44:05 -07:00
CoeNew.lean chore: moving tests to new frontend 2020-09-10 18:00:34 -07:00
coeSort1.lean
coeSort2.lean chore: moving tests to new frontend 2020-09-10 18:00:34 -07:00
CommandExtOverlap.lean test: new frontend 2020-09-29 18:22:34 -07:00
compiler_proj_bug.lean chore: moving tests to new frontend 2020-09-10 18:00:34 -07:00
constantCompilerBug.lean chore: fix tests 2020-05-26 15:05:01 -07:00
core.lean fix: tests and elabDo 2020-09-26 19:12:01 -07:00
csimp_type_error.lean chore: moving tests to new frontend 2020-09-10 18:00:34 -07:00
def1.lean fix: processNonVariable 2020-09-24 17:16:50 -07:00
def2.lean test: add old Lean3 tests 2020-09-24 17:32:47 -07:00
def3.lean test: add old Lean3 tests 2020-09-24 17:32:47 -07:00
def4.lean fix: bug at toBelow 2020-09-24 17:38:51 -07:00
def5.lean test: add old Lean3 tests 2020-09-24 18:01:23 -07:00
def6.lean test: add old Lean3 tests 2020-09-24 18:01:23 -07:00
def7.lean feat: optional ; in terms 2020-09-28 17:10:59 -07:00
def8.lean test: add old Lean3 tests 2020-09-25 06:48:51 -07:00
def9.lean test: add old Lean3 tests 2020-09-25 06:48:51 -07:00
def10.lean test: add old Lean3 tests 2020-09-25 06:48:51 -07:00
def11.lean fix: missing case 2020-09-25 06:48:51 -07:00
def12.lean fix: visit types 2020-09-25 06:48:51 -07:00
def13.lean fix: visit types 2020-09-25 06:48:51 -07:00
def14.lean fix: visit types 2020-09-25 06:48:51 -07:00
def15.lean test: add old Lean3 tests 2020-09-25 06:48:51 -07:00
def16.lean test: add old Lean3 tests 2020-09-25 06:48:51 -07:00
def17.lean test: add old Lean3 tests 2020-09-25 06:48:51 -07:00
def18.lean test: add old Lean3 tests 2020-09-25 06:48:51 -07:00
def19.lean test: add old Lean3 tests 2020-09-25 06:48:51 -07:00
def20.lean test: add old Lean3 tests 2020-09-25 06:48:51 -07:00
DefEqAssignBug.lean test: new frontend 2020-09-29 18:22:34 -07:00
depElim1.lean feat: add string interpolation for MessageData 2020-10-09 20:43:26 -07:00
deriv.lean fix: tests and elabDo 2020-09-26 19:12:01 -07:00
dofun_prec.lean test: new frontend tests 2020-10-09 18:21:45 -07:00
dollarProjIssue.lean fix: dollarProj notation bug 2020-10-10 13:38:07 -07:00
doNotation1.lean chore: move tests to new frontend 2020-10-10 07:41:04 -07:00
doNotation2.lean feat: improve dbgTrace! macro 2020-10-13 12:38:04 -07:00
doNotation3.lean feat: add doElem.quot elaboration function 2020-10-08 13:50:25 -07:00
doNotation4.lean test: string interpolation 2020-10-09 17:02:12 -07:00
doNotation5.lean feat: improve dbgTrace! macro 2020-10-13 12:38:04 -07:00
doNotation6.lean feat: array slicing notation 2020-10-09 16:40:18 -07:00
doTrailingAtEOI.lean fix: trailing ';' at end of input 2020-09-27 16:58:23 -07:00
elab_cmd.lean fix: tests and elabDo 2020-09-26 19:12:01 -07:00
elabCmd.lean chore: add temporary workaround to tests 2020-09-27 06:58:10 -07:00
elabIte.lean
emptycOverloadIssues.lean fix: bug in the old frontend 2020-09-11 14:12:03 -07:00
etaFirst.lean test: unifier 2020-03-05 18:44:33 -08:00
eval_unboxed_const.lean fix: tests and elabDo 2020-09-26 19:12:01 -07:00
evalconst.lean test: new frontend tests 2020-10-09 18:21:45 -07:00
expectedTypePropagation.lean chore: move more tests to new frontend 2020-09-11 10:28:00 -07:00
expr1.lean chore: add temporary workarounds 2020-09-30 07:05:46 -07:00
expr_maps.lean chore: add temporary workarounds 2020-09-30 07:05:46 -07:00
extern.lean chore: move more tests to new frontend 2020-09-11 15:31:14 -07:00
extmacro.lean chore: "begin ... end" ==> "by { ... }" 2020-08-30 14:01:27 -07:00
finally.lean test: new frontend 2020-10-09 13:20:04 -07:00
float1.lean chore: move more tests to new frontend 2020-09-11 15:31:14 -07:00
float_cases_bug.lean chore: move more tests to new frontend 2020-09-11 15:31:14 -07:00
float_from_bignum.lean chore: add temporary workarounds 2020-09-30 07:05:46 -07:00
floatarray.lean chore: move more tests to new frontend 2020-09-11 15:31:14 -07:00
foldConsts.lean chore: move more tests to new frontend 2020-09-11 15:31:14 -07:00
forBodyResultTypeIssue.lean feat: add Repr and HasToString instances for PUnit and ULift 2020-10-12 11:01:59 -07:00
frontend1.lean fix: horrible error message due to constApprox := true 2020-09-29 07:54:48 -07:00
fun.lean chore: move more tests to new frontend 2020-09-11 15:31:14 -07:00
generalize.lean chore: "begin ... end" ==> "by { ... }" 2020-08-30 14:01:27 -07:00
generalizeTelescope.lean test: new frontend 2020-10-09 13:20:04 -07:00
genindices.lean fix: tests and elabDo 2020-09-26 19:12:01 -07:00
getline_crash.lean chore: add temporary workarounds 2020-09-30 07:05:46 -07:00
impByNameResolution.lean fix: use resolveGlobalConstNoOverload at implementedBy attribute handler 2020-10-10 11:40:32 -07:00
implicitTypesRecCoe.lean feat: break PreDefinitions into strongly connected components 2020-09-06 14:22:06 -07:00
incmd.lean feat: expand in command macro 2020-09-02 10:04:58 -07:00
ind_cmd_bug.lean chore: move more tests to new frontend 2020-09-11 15:31:14 -07:00
induction1.lean test: optional ';' 2020-09-28 17:11:00 -07:00
inductive1.lean fix: check inductive datatype parameters in constructor resulting type 2020-09-14 16:56:13 -07:00
inductive2.lean feat: allow commands such as variable and universe in the preamble of a mutual command block 2020-07-16 09:55:51 -07:00
inj1.lean chore: "begin ... end" ==> "by { ... }" 2020-08-30 14:01:27 -07:00
inj2.lean chore: move more tests to new frontend 2020-09-11 15:31:14 -07:00
inline_fn.lean chore: move more tests to new frontend 2020-09-11 15:31:14 -07:00
inliner_loop.lean chore: move more tests to new frontend 2020-09-11 15:31:14 -07:00
instances.lean chore: move more tests to new frontend 2020-09-11 15:31:14 -07:00
instuniv.lean chore: add temporary workaround to tests 2020-09-27 06:58:10 -07:00
int_to_nat_bug.lean chore: move more tests to new frontend 2020-09-11 15:31:14 -07:00
intromacro.lean chore: "begin ... end" ==> "by { ... }" 2020-08-30 14:01:27 -07:00
IO_test.lean test: new frontend tests 2020-10-09 18:21:45 -07:00
irCompilerBug.lean fix: tests and elabDo 2020-09-26 19:12:01 -07:00
kernel1.lean fix: tests and elabDo 2020-09-26 19:12:01 -07:00
kernel2.lean fix: tests and elabDo 2020-09-26 19:12:01 -07:00
kevin.lean feat: adjust semantics to new syntax 2020-08-19 09:56:23 -07:00
level.lean chore: move more tests to new frontend 2020-09-11 15:31:14 -07:00
LiftMethodIssue.lean feat: remove old elabDo 2020-10-04 17:14:36 -07:00
listDecEq.lean chore: move more tests to new frontend 2020-09-11 15:31:14 -07:00
localNameResolutionWithProj.lean fix: local name resolution 2020-10-05 17:32:46 -07:00
macro.lean chore: fix some tests 2020-06-08 16:12:06 -07:00
macro2.lean fix: notation command 2020-06-09 14:11:34 -07:00
macro3.lean
macro_macro.lean
macroid.lean feat: adjust semantics to new syntax 2020-08-19 09:56:23 -07:00
match1.lean fix: expandMatchDiscr cannot be a macro 2020-09-15 13:29:28 -07:00
matchArrayLit.lean chore: move more tests to new frontend 2020-09-11 15:31:14 -07:00
matchDiscrType.lean fix: (try to) postpone when discriminant type is not known 2020-10-10 16:16:22 -07:00
matcherElimUniv.lean fix: the generated matcher must be able to eliminate into different universe levels 2020-09-24 19:34:14 -07:00
matchNoPostponing.lean fix: tests and elabDo 2020-09-26 19:12:01 -07:00
matchtac.lean fix: missing checkColGt and tests 2020-09-28 17:10:59 -07:00
meta1.lean fix: tests and elabDo 2020-09-26 19:12:01 -07:00
meta2.lean test: new frontend 2020-09-29 18:22:34 -07:00
meta3.lean chore: add temporary workaround to tests 2020-09-27 06:58:10 -07:00
meta4.lean chore: cleanup 2020-09-28 19:05:48 -07:00
meta5.lean feat: add string interpolation for MessageData 2020-10-09 20:43:26 -07:00
meta6.lean chore: cleanup 2020-09-28 19:05:48 -07:00
meta7.lean chore: cleanup 2020-09-28 19:05:48 -07:00
mixedMacroRules.lean chore: fix tests 2020-06-08 16:18:46 -07:00
mixfix.lean feat: expand macros infix, infixl, infixr, prefix, and postfix 2020-09-07 16:35:25 -07:00
monadCache.lean fix: tests and elabDo 2020-09-26 19:12:01 -07:00
monadControl.lean chore: adjust test 2020-10-04 16:19:50 -07:00
namespaceIssue.lean fix: old&new frontend interference 2020-09-20 08:25:45 -07:00
nativeReflBackdoor.lean feat: elaborate #print axioms command 2020-08-28 13:08:42 -07:00
natlit.lean fix: nat lit support 2020-03-13 06:54:33 -07:00
nested_match_bug.lean chore: move more tests to new frontend 2020-09-11 15:31:14 -07:00
new_compiler.lean fix: horrible error message due to constApprox := true 2020-09-29 07:54:48 -07:00
new_frontend2.lean test: new frontend 2020-09-29 18:22:34 -07:00
new_inductive.lean fix: bug at inductive datatype resulting universe inference 2020-09-11 16:07:22 -07:00
new_inductive2.lean chore: move more tests to new frontend 2020-09-11 16:28:57 -07:00
newfrontend1.lean chore: remove workaround 2020-10-06 08:28:41 -07:00
newfrontend2.lean chore: move more tests to new frontend 2020-09-11 16:28:57 -07:00
newfrontend3.lean chore: move more tests to new frontend 2020-09-11 16:28:57 -07:00
newfrontend4.lean
newfrontend5.lean chore: move more tests to new frontend 2020-09-11 17:36:37 -07:00
nicerNestedDos.lean test: new frontend 2020-09-29 18:22:34 -07:00
noncomputable_bug.lean chore: move more tests to new frontend 2020-09-11 17:36:37 -07:00
obtain.lean test: new frontend 2020-09-29 18:22:34 -07:00
optParam.lean fix: handle optParam at consumeImplicits 2020-10-11 15:26:10 -07:00
overloaded.lean fix: always ensure expectedType when processing overloaded symbols and/or notation 2020-09-13 11:59:13 -07:00
parseCore.lean fix: tests and elabDo 2020-09-26 19:12:01 -07:00
partial1.lean test: new frontend 2020-09-29 18:22:34 -07:00
partialApp.lean refactor: elabAppArgsAux 2020-10-11 15:08:12 -07:00
patbug.lean test: new frontend 2020-09-29 18:22:34 -07:00
print_cmd.lean chore: move more tests to new frontend 2020-09-11 17:36:37 -07:00
proofIrrelFVar.lean fix: isDefEqQuick 2020-08-15 13:24:43 -07:00
prv.lean fix: resolveGlobalName for atomic references to private names 2020-07-23 14:58:19 -07:00
ptrAddr.lean chore: move more tests to new frontend 2020-09-11 17:36:37 -07:00
quasi_pattern_unification_approx_issue.lean test: new frontend 2020-09-29 18:22:34 -07:00
range.lean feat: add Range notation 2020-10-12 11:50:13 -07:00
rc_tests.lean chore: move more tests to new frontend 2020-09-12 07:54:12 -07:00
readerThe.lean feat: add withReader method 2020-10-13 15:00:17 -07:00
recInfo1.lean test: new frontend 2020-09-29 18:22:34 -07:00
reduce1.lean chore: move more tests to new frontend 2020-09-12 07:54:12 -07:00
reduce2.lean test: add rfl tests 2020-03-17 16:18:18 -07:00
reduce3.lean test: decide! tests 2020-03-18 16:48:28 -07:00
Reformat.lean test: new frontend tests 2020-10-09 18:21:45 -07:00
Reid1.lean chore: moving tests to new frontend 2020-09-10 18:00:34 -07:00
Reparen.lean chore: add temporary workarounds 2020-09-30 07:05:46 -07:00
replace.lean chore: move more tests to new frontend 2020-09-12 07:54:12 -07:00
resolveLVal.lean feat: improve resolveLVal 2020-09-07 12:25:43 -07:00
revert1.lean chore: "begin ... end" ==> "by { ... }" 2020-08-30 14:01:27 -07:00
scc.lean test: new frontend tests 2020-10-09 18:21:45 -07:00
sharecommon.lean test: new frontend tests 2020-10-09 18:21:45 -07:00
spec_issue.lean test: new frontend 2020-09-29 18:22:34 -07:00
stateRef.lean chore: add temporary workarounds 2020-09-30 07:05:46 -07:00
strInterpolation.lean feat: add interpolated string for toString 2020-10-09 14:38:24 -07:00
struct1.lean test: basic tests for new structure command 2020-07-24 12:13:02 -07:00
struct2.lean fix: id marker for auxiliary _default declarations 2020-07-24 15:59:45 -07:00
struct3.lean test: structure 2020-07-27 16:07:19 -07:00
struct_inst_typed.lean chore: move tests to new frontend 2020-09-13 10:16:15 -07:00
struct_instance_in_eqn.lean chore: move tests to new frontend 2020-09-13 10:16:15 -07:00
structInst.lean chore: move more tests to new frontend 2020-09-12 07:54:12 -07:00
structInst2.lean chore: add temporary workaround to tests 2020-09-27 06:58:10 -07:00
structInst3.lean fix: kind for type metavariable 2020-09-16 08:24:15 -07:00
structInst4.lean chore: move tests to new frontend 2020-09-13 10:16:15 -07:00
structuralIssue.lean feat: improve Structural.lean 2020-10-12 16:58:30 -07:00
structuralRec1.lean test: new tests for structural recursion 2020-09-23 18:24:56 -07:00
structure.lean chore: add temporary workarounds 2020-09-30 07:05:46 -07:00
stxKindInsideNamespace.lean fix: explicit syntax kind in macro_rules 2020-10-10 06:42:45 -07:00
stxMacro.lean test: new frontend 2020-10-09 13:20:04 -07:00
subst1.lean test: new frontend 2020-09-29 18:22:34 -07:00
synth1.lean test: new frontend 2020-09-29 18:22:34 -07:00
synthPending1.lean feat: synthPending implementation 2020-03-13 13:52:00 -07:00
tactic.lean test: new frontend 2020-09-29 18:22:34 -07:00
tactic1.lean fix: missing checkColGt and tests 2020-09-28 17:10:59 -07:00
tacticExtOverlap.lean chore: "begin ... end" ==> "by { ... }" 2020-08-30 14:01:27 -07:00
task_test.lean fix: Task: make reference and -j0 semantics eager, simplify 2020-09-14 17:57:33 +02:00
task_test2.lean feat: improve dbgTrace! macro 2020-10-13 12:38:04 -07:00
task_test_io.lean feat: more IO Task functions 2020-09-14 17:57:33 +02:00
termElab.lean fix: tests and elabDo 2020-09-26 19:12:01 -07:00
termParserAttr.lean fix: horrible error message due to constApprox := true 2020-09-29 07:54:48 -07:00
termparsertest1.lean chore: add temporary workaround to tests 2020-09-27 06:58:10 -07:00
test_single.sh chore: factor out and unify common test behavior; retrieve lean from PATH 2020-05-14 14:38:52 +02:00
toExpr.lean chore: add temporary workarounds 2020-09-30 07:05:46 -07:00
trace.lean feat: add withReader method 2020-10-13 15:00:17 -07:00
tryPureCoe.lean test: new frontend tests 2020-10-09 18:21:45 -07:00
type_class_performance1.lean chore: move more tests to new frontend 2020-09-12 09:04:39 -07:00
typeclass_append.lean chore: move more tests to new frontend 2020-09-12 09:04:39 -07:00
typeclass_coerce.lean fix: horrible error message due to constApprox := true 2020-09-29 07:54:48 -07:00
typeclass_diamond.lean feat: pretty print Syntax in messages 2020-09-29 07:59:22 -07:00
typeclass_easy.lean feat: pretty print Syntax in messages 2020-09-29 07:59:22 -07:00
typeclass_loop.lean fix: tests and elabDo 2020-09-26 19:12:01 -07:00
typeclass_metas_internal_goals1.lean chore: move more tests to new frontend 2020-09-12 09:04:39 -07:00
typeclass_metas_internal_goals2.lean chore: move more tests to new frontend 2020-09-12 09:04:39 -07:00
typeclass_metas_internal_goals3.lean chore: move more tests to new frontend 2020-09-12 09:04:39 -07:00
typeclass_metas_internal_goals4.lean chore: move more tests to new frontend 2020-09-12 09:04:39 -07:00
typeclass_outparam.lean chore: move more tests to new frontend 2020-09-12 09:04:39 -07:00
ubscalar.lean chore: move more tests to new frontend 2020-09-12 09:04:39 -07:00
unexpected_result_with_bind.lean fix: tests and elabDo 2020-09-26 19:12:01 -07:00
unif_issue.lean fix: tests and elabDo 2020-09-26 19:12:01 -07:00
unif_issue2.lean chore: fix tests 2020-05-26 15:05:01 -07:00
update.lean chore: fix tests 2020-05-26 15:05:00 -07:00
WindowsNewlines.lean fix: support Windows newlines and '\r' escape 2020-03-27 13:21:21 -07:00