Mercurial > urweb
comparison src/compiler.sml @ 1738:1a35e75b6967
Catch duplicate top-level module names; fix dropping of constraints during incremental elaboration; document treatment of record types as type class instance types
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Thu, 03 May 2012 09:56:41 -0400 |
parents | ab24a7cb2a64 |
children | c414850f206f |
comparison
equal
deleted
inserted
replaced
1737:78d7cc9c9b18 | 1738:1a35e75b6967 |
---|---|
941 | 941 |
942 val loc = {file = ur, | 942 val loc = {file = ur, |
943 first = ErrorMsg.dummyPos, | 943 first = ErrorMsg.dummyPos, |
944 last = ErrorMsg.dummyPos} | 944 last = ErrorMsg.dummyPos} |
945 | 945 |
946 val urt = OS.FileSys.modTime ur | |
947 val urst = (OS.FileSys.modTime urs) handle _ => urt | |
948 | |
946 val ds = #func parseUr ur | 949 val ds = #func parseUr ur |
947 val d = (Source.DStr (mname, sgnO, if !Elaborate.incremental then SOME (OS.FileSys.modTime ur) else NONE, | 950 val d = (Source.DStr (mname, sgnO, if !Elaborate.incremental then SOME (if Time.> (urt, urst) then urt else urst) else NONE, |
948 (Source.StrConst ds, loc)), loc) | 951 (Source.StrConst ds, loc)), loc) |
949 | 952 |
950 val fname = OS.Path.mkCanonical fname | 953 val fname = OS.Path.mkCanonical fname |
951 val d = case List.find (fn (root, name) => | 954 val d = case List.find (fn (root, name) => |
952 String.isPrefix (root ^ "/") fname) mrs of | 955 String.isPrefix (root ^ "/") fname) mrs of |
1076 | 1079 |
1077 val ds = case onError of | 1080 val ds = case onError of |
1078 NONE => ds | 1081 NONE => ds |
1079 | SOME v => ds @ [(Source.DOnError v, loc)] | 1082 | SOME v => ds @ [(Source.DOnError v, loc)] |
1080 in | 1083 in |
1084 ignore (List.foldl (fn (d, used) => | |
1085 case #1 d of | |
1086 Source.DStr (x, _, _, _) => | |
1087 if SS.member (used, x) then | |
1088 (ErrorMsg.errorAt (#2 d) ("Duplicate top-level module name " ^ x); | |
1089 used) | |
1090 else | |
1091 SS.add (used, x) | |
1092 | _ => used) SS.empty ds); | |
1081 ds | 1093 ds |
1082 end handle Empty => ds | 1094 end handle Empty => ds |
1083 end, | 1095 end, |
1084 print = SourcePrint.p_file | 1096 print = SourcePrint.p_file |
1085 } | 1097 } |