@@ -22,10 +22,7 @@ import Agda.Syntax.Concrete as C
2222import Agda.Syntax.Internal (alwaysUnblock )
2323import Agda.Syntax.Position (HasRange (getRange ), Range , noRange )
2424import Agda.Syntax.Scope.Base
25- import Agda.TypeChecking.Errors (getAllWarningsOfTCErr , prettyError )
26- #if MIN_VERSION_Agda(2,6,3)
27- import Agda.TypeChecking.Errors (explainWhyInScope )
28- #endif
25+ import Agda.TypeChecking.Errors (getAllWarningsOfTCErr , prettyError , explainWhyInScope )
2926import Agda.TypeChecking.Monad hiding (Function )
3027import Agda.TypeChecking.Monad.MetaVars (withInteractionId )
3128import Agda.TypeChecking.Pretty (prettyTCM )
@@ -278,13 +275,8 @@ fromDisplayInfo = \case
278275 " Definitions about"
279276 <+> text (List. intercalate " , " $ words names) $$ nest 2 (align 10 hitDocs)
280277 return $ IR. DisplayInfoGeneric " Search About" [Unlabeled (Render. text $ show doc) Nothing Nothing ]
281- #if MIN_VERSION_Agda(2,6,3)
282278 Info_WhyInScope why -> do
283279 doc <- explainWhyInScope why
284- #else
285- Info_WhyInScope s cwd v xs ms -> do
286- doc <- explainWhyInScope s cwd v xs ms
287- #endif
288280 return $ IR. DisplayInfoGeneric " Scope Info" [Unlabeled (Render. text $ show doc) Nothing Nothing ]
289281 Info_Context ii ctx -> do
290282 doc <- localTCState (prettyResponseContexts ii False ctx)
@@ -373,91 +365,6 @@ lispifyGoalSpecificDisplayInfo ii kind = localTCState $
373365
374366--------------------------------------------------------------------------------
375367
376- #if !MIN_VERSION_Agda(2,6,3)
377- explainWhyInScope ::
378- String ->
379- FilePath ->
380- Maybe LocalVar ->
381- [AbstractName ] ->
382- [AbstractModule ] ->
383- TCM Doc
384- explainWhyInScope s _ Nothing [] [] = TCP. text (s ++ " is not in scope." )
385- explainWhyInScope s _ v xs ms =
386- TCP. vcat
387- [ TCP. text (s ++ " is in scope as" ),
388- TCP. nest 2 $ TCP. vcat [variable v xs, modules ms]
389- ]
390- where
391- -- variable :: Maybe _ -> [_] -> TCM Doc
392- variable Nothing vs = names vs
393- variable (Just x) vs
394- | null vs = asVar
395- | otherwise =
396- TCP. vcat
397- [ TCP. sep [asVar, TCP. nest 2 $ shadowing x],
398- TCP. nest 2 $ names vs
399- ]
400- where
401- asVar :: TCM Doc
402- asVar =
403- " * a variable bound at" TCP. <+> TCP. prettyTCM (nameBindingSite $ localVar x)
404- shadowing :: LocalVar -> TCM Doc
405- shadowing (LocalVar _ _ [] ) = " shadowing"
406- shadowing _ = " in conflict with"
407- names = TCP. vcat . fmap pName
408- modules = TCP. vcat . fmap pMod
409-
410- pKind = \ case
411- AxiomName -> " postulate"
412- ConName -> " constructor"
413- CoConName -> " coinductive constructor"
414- DataName -> " data type"
415- DisallowedGeneralizeName -> " generalizable variable from let open"
416- FldName -> " record field"
417- FunName -> " defined name"
418- GeneralizeName -> " generalizable variable"
419- MacroName -> " macro name"
420- PatternSynName -> " pattern synonym"
421- PrimName -> " primitive function"
422- QuotableName -> " quotable name"
423- -- previously DefName:
424- RecName -> " record type"
425- OtherDefName -> " defined name"
426-
427- pName :: AbstractName -> TCM Doc
428- pName a =
429- TCP. sep
430- [ " * a"
431- TCP. <+> pKind (anameKind a)
432- TCP. <+> TCP. text (prettyShow $ anameName a),
433- TCP. nest 2 " brought into scope by"
434- ]
435- TCP. $$ TCP. nest 2 (pWhy (nameBindingSite $ qnameName $ anameName a) (anameLineage a))
436- pMod :: AbstractModule -> TCM Doc
437- pMod a =
438- TCP. sep
439- [ " * a module" TCP. <+> TCP. text (prettyShow $ amodName a),
440- TCP. nest 2 " brought into scope by"
441- ]
442- TCP. $$ TCP. nest 2 (pWhy (nameBindingSite $ qnameName $ mnameToQName $ amodName a) (amodLineage a))
443-
444- pWhy :: Range -> WhyInScope -> TCM Doc
445- pWhy r Defined = " - its definition at" TCP. <+> TCP. prettyTCM r
446- pWhy r (Opened (C. QName x) w) | isNoName x = pWhy r w
447- pWhy r (Opened m w) =
448- " - the opening of"
449- TCP. <+> TCP. prettyTCM m
450- TCP. <+> " at"
451- TCP. <+> TCP. prettyTCM (getRange m)
452- TCP. $$ pWhy r w
453- pWhy r (Applied m w) =
454- " - the application of"
455- TCP. <+> TCP. prettyTCM m
456- TCP. <+> " at"
457- TCP. <+> TCP. prettyTCM (getRange m)
458- TCP. $$ pWhy r w
459- #endif
460-
461368-- | Pretty-prints the context of the given meta-variable.
462369prettyResponseContexts ::
463370 -- | Context of this meta-variable.
0 commit comments