Skip to content

Commit d72a3c3

Browse files
committed
chore: add a test for differential geometry elaborator errors in the … (leanprover-community#34564)
…presence of metavariables The error is not great; let's document the current behaviour before we improve it.
1 parent ac2b114 commit d72a3c3

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

MathlibTest/DifferentialGeometry/NotationAdvanced.lean

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,32 @@ variable (F : Type*) [NormedAddCommGroup F] [NormedSpace 𝕜 F]
3939
[FiberBundle F V] [VectorBundle 𝕜 F V]
4040
-- `V` vector bundle
4141

42+
section ErrorMetavars -- Test for error messages when the goal still has metavariables.
43+
44+
-- The argument k is deliberately implicit; it should be explicit in a mathlib definition.
45+
def proj : TangentBundle 𝓘(𝕜, 𝕜) 𝕜 → 𝕜 := fun x ↦ x.2
46+
47+
open ContDiff
48+
49+
-- TODO: the error message could be more helpful, by saying "the goal has metavariables; maybe there is an implicit argument missing"
50+
/--
51+
error: Could not find a model with corners for `TangentBundle 𝓘(?_, ?_) ?_`.
52+
53+
Hint: failures to find a model with corners can be debugged with the command `set_option trace.Elab.DiffGeo.MDiff true`.
54+
-/
55+
#guard_msgs in
56+
set_option pp.mvars.anonymous false in
57+
lemma contMDiff_proj : CMDiff ∞ (proj) := by
58+
unfold proj
59+
exact contMDiff_snd_tangentBundle_modelSpace 𝕜 𝓘(𝕜)
60+
61+
-- Adding the implicit argument k works.
62+
example : CMDiff ∞ (proj (𝕜 := 𝕜)) := by
63+
unfold proj
64+
exact contMDiff_snd_tangentBundle_modelSpace 𝕜 𝓘(𝕜)
65+
66+
end ErrorMetavars
67+
4268
/-! Additional tests for the elaborators for `MDifferentiable{WithinAt,At,On}`. -/
4369
section differentiability
4470

0 commit comments

Comments
 (0)