Skip to content

Commit

Permalink
Differentiate missing type and expression symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
elliottt committed Dec 3, 2014
1 parent b9e6f13 commit b984bb5
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/Cryptol/ModuleSystem/Renamer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@ import qualified Data.Map as Map
data RenamerError
= MultipleSyms (Located QName) [NameOrigin]
-- ^ Multiple imported symbols contain this name
| UnboundSym (Located QName)
-- ^ Symbol is not bound to any definition

| UnboundExpr (Located QName)
-- ^ Expression name is not bound to any definition

| UnboundType (Located QName)
-- ^ Type name is not bound to any definition

| OverlappingSyms [NameOrigin]
-- ^ An environment has produced multiple overlapping symbols

Expand All @@ -56,8 +61,11 @@ instance PP RenamerError where
hang (text "[error] Multiple definitions for symbol:" <+> pp lqn)
4 (vcat (map pp qns))

UnboundSym lqn ->
text "[error] unbound symbol:" <+> pp lqn
UnboundExpr lqn ->
text "[error] unbound identifier:" <+> pp lqn

UnboundType lqn ->
text "[error] unbound type:" <+> pp lqn

-- XXX these really need to be located
OverlappingSyms qns ->
Expand Down Expand Up @@ -258,7 +266,7 @@ renameExpr qn = do
return qn
Nothing ->
do n <- located qn
record (UnboundSym n)
record (UnboundExpr n)
return qn

renameType :: QName -> RenameM QName
Expand All @@ -273,7 +281,7 @@ renameType qn = do
return qn
Nothing ->
do n <- located qn
record (UnboundSym n)
record (UnboundType n)
return qn

-- | Rename a schema, assuming that none of its type variables are already in
Expand Down

0 comments on commit b984bb5

Please sign in to comment.