Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: exception Assert_failure("typing/ctype.ml", 252, 30) #2562

Closed
vicuna opened this issue May 8, 2004 · 1 comment
Closed

Fatal error: exception Assert_failure("typing/ctype.ml", 252, 30) #2562

vicuna opened this issue May 8, 2004 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented May 8, 2004

Original bug ID: 2562
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Andreas Hauser
Version: 3.07 and cvs 8. May 2004
OS: DragonFly, FreeBSD and Linux
Submission from: pd9e97d1e.dip.t-dialin.net (217.233.125.30)

(* The following code produces: )
(
Fatal error: exception Assert_failure("typing/ctype.ml", 252, 30) *)

class node s =
    object(self:'node)
        val mutable symbol = s
        method symbol      = symbol

        val mutable leaf  = false
        method leaf       = leaf
        method set_leaf b = leaf <- b

        val mutable transitions   = []
        method transitions        = transitions
        method get_transition key = List.assoc key transitions
        method add_transition (key,node) =
            transitions <- (key, node) :: transitions

        val mutable id  = 0
        method id       = id
        method set_id i = id <- i

        method private insert_suffix_tree root s suffix_chain =
            if String.length s > 0 then
                let key = Str.first_chars s 1 in
                let f acc current_node  =
                    try
                        (current_node#get_transition key) :: acc
                    with Not_found ->
                        let new_node : #node = new node key in
                        current_node#add_transition (key, new_node);
                        new_node :: acc
                in
                root#print_digraph;
                self#insert_suffix_tree root (Str.string_after s 1)

(List.fold_left f [root] suffix_chain)
else
(* the suffix_chain will contain all essential nodes (leafs)
*)
List.iter (fun n -> if n != root then n#set_leaf true)
suffix_chain;

        (* without the coercions a bug seems to be triggered in ocaml *)
        (* self#insert_suffix_tree (self :> node> s [(self :> node)] *)
        method suffix_tree s =
            self#insert_suffix_tree self s [self]

end;;

@vicuna
Copy link
Author

vicuna commented May 28, 2004

Comment author: administrator

Fixed in ctype.ml by JG (2004-05-28)

@vicuna vicuna closed this as completed May 28, 2004
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant