on master help sign in
Merge branch 'java-name-mangling' into error-reflection
commit33d07ac10059f9a390320949f5388202142ac104 authorDavid Raymond Christiansen <david@davidchristiansen.dk> dateWed 29 Jan 2014, 18:13 (13 years ago) parente46603ab5e9afe
2 files changed+7−1
src/IRTS/Java/Mangling.hs+4−1 src/Idris/Delaborate.hs+3
src/IRTS/Java/Mangling.hs+4−1
@@ -88,7 +88,8 @@ mangleWithPrefix prefix (UN name) =
8888 | x == ' ' = "_Space" ++ cleanNonLetter xs
8989 | x == ',' = "_Comma" ++ cleanNonLetter xs
9090 | x == '_' = "__" ++ cleanNonLetter xs
91− | not (isAlphaNum x) = "_" ++ (show $ ord x) ++ xs
91+ -- 10 digits is the most possible to represent 2^32 (ie all of unicode)
92+ | not (isAlphaNum x) = "_" ++ (padToWith 10 '0' . show $ ord x) ++ cleanNonLetter xs
9293 | otherwise = x:cleanNonLetter xs
9394 cleanNonLetter [] = []
9495 cleanWs capitalize (x:xs)
@@ -96,6 +97,8 @@ mangleWithPrefix prefix (UN name) =
9697 | capitalize = (toUpper x) : (cleanWs False xs)
9798 | otherwise = x : (cleanWs False xs)
9899 cleanWs _ [] = []
100+ padToWith :: Int -> a -> [a] -> [a]
101+ padToWith n p xs = replicate (length xs - n) p ++ xs
99102mangleWithPrefix prefix s@(SN _) = mangleWithPrefix prefix (sUN (showCG s))
100103
101104mangle :: (Applicative m, MonadError String m) => Name -> m Ident
src/Idris/Delaborate.hs+3
@@ -155,6 +155,9 @@ pprintErr' i (CantConvert x y env) =
155155 text "Can't convert" <> indented (pprintTerm i (delab i x)) <>
156156 text "with" <> indented (pprintTerm i (delab i y)) <>
157157 if (opt_errContext (idris_options i)) then text (showSc i env) else empty
158+pprintErr' i (CantSolveGoal x env) =
159+ text "Can't solve goal " <> indented (pprintTerm i (delab i x)) <>
160+ if (opt_errContext (idris_options i)) then text (showSc i env) else empty
158161pprintErr' i (UnifyScope n out tm env) =
159162 text "Can't unify" <> indented (annName n) <+>
160163 text "with" <> indented (pprintTerm i (delab i tm)) <+>