You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: hover and highlight info from builtin assert docstring roles (#14039)
This PR fixes a bug where the builting docstring roles for asserting
equalities did not properly highlight their contents for downstream
consumers of rich docstring info, and exposes a structure that was
mistakenly made private.
I used Claude while making this PR.
unless ← Meta.withTransparency .all <| Meta.isDefEq lhs rhs do
1235
-
throwErrorAt stx m!"Expected {lhs} = {rhs}, which is {← Meta.whnf lhs} = {← Meta.whnf rhs}, reducing to {← Meta.reduceAll lhs} = {← Meta.reduceAll rhs} but they are not equal."
1236
-
pure (.code s.getString)
1243
+
let codes ← onlyCodes xs
1244
+
let (lhsCode, rhsCode, tyCode?) ←
1245
+
match h : codes.size with
1246
+
| 2 => pure (codes[0], codes[1], none)
1247
+
| 3 => pure (codes[0], codes[1], some codes[2])
1248
+
| _ => throwError"Expected two or three code arguments: the two sides of the equality, \
1249
+
optionally followed by their type, but got {codes.size} arguments."
1250
+
let lhsStx ← parseStrLit assertTermContents lhsCode
1251
+
let rhsStx ← parseStrLit assertTermContents rhsCode
1252
+
let tyStx? ← tyCode?.mapM (parseStrLit assertTermContents)
1253
+
withSaveInfoContext do
1254
+
let ty? ← withoutErrToSorry <|
1255
+
match tyStx? with
1256
+
| some tyStx => some <$> elabType tyStx
1257
+
| none => pure none
1258
+
let lhs ← elabExtraTerm lhsStx ty?
1259
+
let rhs ← elabExtraTerm rhsStx ty?
1260
+
unless ← Meta.withTransparency .all <| Meta.isDefEq lhs rhs do
1261
+
throwErrorm!"Expected {lhs} = {rhs}, which is {← Meta.whnf lhs} = {← Meta.whnf rhs}, reducing to {← Meta.reduceAll lhs} = {← Meta.reduceAll rhs} but they are not equal."
0 commit comments