Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004438OCamlOCaml generalpublic2007-11-02 19:292013-07-28 21:27
Reporterthelema 
Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.10.0 
Target VersionFixed in Version 
Summary0004438: Spell-check unbound identifiers
DescriptionI have modified my copy of ocaml to report more information on failure to locate an identifier. It searches through the tree of currently bound identifiers for identifiers that could have been intended (looking for a single insertion, deletion, transposition or error). The first one of these is printed out as part of the error message, as follows:

File "coml.ml", line 468, characters 19-23:
Unbound value acts, possible misspelling of act
Additional InformationPatch applies to 3.10.0 source tree.
TagsNo tags attached.
Attached Filespatch file icon ocaml-spelling-3.10.0.patch [^] (21,960 bytes) 2007-11-02 19:29 [Show Content]

- Relationships

-  Notes
(0004265)
xleroy (administrator)
2007-11-10 14:06

It's a cool hack, but I'm not sure this has its place in a compiler -- looks more like a job for a programming environment. I'll leave this as a feature wish.
(0004301)
thelema (reporter)
2007-11-13 16:46

I got the idea from a compiler I regard as having the best error messages: GNAT. This feature has saved me plenty of work tracking down correct spellings. I admit that it could also be implemented in an IDE, but it'd become much more hackish there, with having to keep track of scope and namespaces, unless the compiler were (too) strongly integrated into the IDE (like Eclipse).
(0004321)
thelema (reporter)
2007-11-16 20:43

Additional patch piece that fixes an uncaught exception in the toplevel when dealing with values in modules.


diff --git a/toplevel/genprintval.ml b/toplevel/genprintval.ml
index a0d88ef..b006abb 100644
--- a/toplevel/genprintval.ml
+++ b/toplevel/genprintval.ml
@@ -148,7 +148,7 @@ module Make(O : OBJ)(EVP : EVALPATH with type value = O.t) = struct
                match (lookup_fun (Lident name) env).desc with
                | Tconstr(ty_path', _, _) -> Path.same ty_path ty_path'
                | _ -> false
- with Not_found -> false
+ with Not_found | Ident.Found_nearly _ -> false
           then Oide_ident name
           else Oide_dot (Printtyp.tree_of_path p, name)
       | Papply(p1, p2) ->
(0009942)
gasche (developer)
2013-07-28 21:27

I independently proposed the exact same feature, with a rather similar implementation (but using a generic edit distance test with a cutoff of 3 instead of a specialized implementation), in PR#5768. I suppose people where more ready to the idea at this later time, so the feature got more support and was eventually integrated.

- Issue History
Date Modified Username Field Change
2007-11-02 19:29 thelema New Issue
2007-11-02 19:29 thelema File Added: ocaml-spelling-3.10.0.patch
2007-11-10 14:06 xleroy Note Added: 0004265
2007-11-10 14:06 xleroy Status new => acknowledged
2007-11-13 16:46 thelema Note Added: 0004301
2007-11-16 20:43 thelema Note Added: 0004321
2013-07-28 21:27 gasche Note Added: 0009942
2013-07-28 21:27 gasche Status acknowledged => closed
2013-07-28 21:27 gasche Resolution open => fixed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker