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

ocamlc -i reports wrong type information #2934

Closed
vicuna opened this issue Aug 28, 2001 · 3 comments
Closed

ocamlc -i reports wrong type information #2934

vicuna opened this issue Aug 28, 2001 · 3 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Aug 28, 2001

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

Bug description

Hi,

when I compile the attached program with -i option I get

class ['a] top_pre_iface_class : string -> 'a -> ['a] top_pre_iface_type

but

new top_pre_iface_class "a"

does not have type 'a -> ['a] top_pre_iface_type

I used Objective Caml compiler, version 3.02 on Linux 2.2.18.

Bye,

Hendrik


type ('cl) top_pre_types =
| Class of 'cl * ('cl) top_pre_argument_type list

and ('cl) top_pre_argument_type =
| TypeArgument of (('cl) top_pre_types)

type ('cl) top_pre_component_type =
'cl * ('cl) top_pre_argument_type list

class type ['super_class] top_pre_iface_type

object

val name : 
  string

method get_name : 
  string

method add_ancestor : 
  'super_class -> unit

method get_ancestors : 
  'super_class list

method add_component : 
  ('super_class) top_pre_component_type -> unit

method get_components :
  ('super_class) top_pre_component_type list

end

class type top_iface_type
= [top_iface_type] top_pre_iface_type

type top_top_types = (top_iface_type) top_pre_types

type top_output_types =
top_top_types

type top_argument_type =
(top_iface_type) top_pre_argument_type

let eq_string (s1 : string) (s2 : string) = s1 = s2

let rec eq_top_types t1 t2 = t1 == t2 or match t1,t2 with
| Class(cl1, args1),Class(cl2, args2) ->
(eq_string cl1#get_name cl2#get_name)
&& (List.length args1 = List.length args2)
&& (List.for_all2 eq_top_args args1 args2)

and eq_top_args (a1 : top_argument_type) (a2 : top_argument_type)
= match a1,a2 with
| TypeArgument typ1, TypeArgument typ2 ->
eq_top_types typ1 typ2

class
['super_class] top_pre_iface_class
name
first_anc
:
['super_class] top_pre_iface_type
= object (s : 'self)

val name =
      (name : string)

val mutable ancestors =
      ([first_anc] : 'super_class list)

method get_name =
  name

method add_ancestor m =
  (ancestors <- ancestors @ [m])

method get_ancestors=
  ancestors

val mutable components = 
  ([] : ('super_class) top_pre_component_type list)

method add_component comp =

  let (c, args) = comp in 
  	if not (List.exists 
	  (fun (c',args') -> ((c'#get_name = c#get_name) &&
			      (List.for_all2 eq_top_args args args')))
	  components)
  	then 

  	  components <- components @ [comp]

method get_components = components

end

let o = new top_pre_iface_class "a"

(*** Local Variables: )
(
version-control: t )
(
compile-command: "ocamlc -i eq_args_bug.ml" )
(
kept-new-versions: 10 )
(
delete-old-versions: t )
(
End: ***)



@vicuna
Copy link
Author

vicuna commented Sep 28, 2001

Comment author: administrator

when I compile the attached program with -i option I get

class ['a] top_pre_iface_class : string -> 'a -> ['a] top_pre_iface_type

but

new top_pre_iface_class "a"

does not have type 'a -> ['a] top_pre_iface_type

Yes, this is a bug that you reported long ago (#2325)
But checking this is rather complicated: you have to verify that hidden types
have not changed, but this is OK for non-hidden ones.

So, yes, we keep it mind, but do not hold your breath.

Jacques Garrigue

@vicuna
Copy link
Author

vicuna commented Sep 28, 2001

Comment author: administrator

Identical to #2325

@vicuna
Copy link
Author

vicuna commented Sep 28, 2001

Comment author: administrator

Yes, this is a bug that you reported long ago (#2325)

So, yes, we keep it mind, but do not hold your breath.

OK, I thought it is different.

Bye,

Hendrik

@vicuna vicuna closed this as completed Dec 4, 2001
@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