Skip to content

Commit

Permalink
Fix dhall-docs panic (#2552)
Browse files Browse the repository at this point in the history
Fixes #2529
  • Loading branch information
Gabriella439 authored Nov 25, 2023
1 parent 8982b76 commit 44b9f30
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dhall-docs/src/Dhall/Docs/CodeRenderer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -245,16 +245,16 @@ fragments = Data.List.sortBy sorter . removeUnusedDecls . Writer.execWriter . in
return NoInfo

where
handleRecordLike l = RecordFields . Set.fromList <$> mapM f l
handleRecordLike l = RecordFields . Set.fromList . concat <$> mapM f l
where
f (key, RecordField (Just Src{srcEnd = startPos}) val (Just Src{srcStart = endPos}) _) = do
dhallType <- infer context val
let nameSrc = makeSrcForLabel startPos endPos key
let nameDecl = NameDecl nameSrc key dhallType
Writer.tell [SourceCodeFragment nameSrc (NameDeclaration nameDecl)]
return nameDecl
return [ nameDecl ]
where
f _ = fileAnIssue "A `RecordField` of type `Expr Src Import` doesn't have `Just src*`"
f _ = return [ ]

fileAsText :: File -> Text
fileAsText File{..} = foldr (\d acc -> acc <> "/" <> d) "" (Core.components directory)
Expand Down

0 comments on commit 44b9f30

Please sign in to comment.