2024-11-21 23:33 AEDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000129mercuryBugpublic2010-01-25 16:29
Reporterwangp 
Assigned Towangp 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0000129: java grade generates uncompilable code for some uses of typeclasses
DescriptionFrom Max:

"For your information,
I have a bug in the Java BE of Mercury.
It all compiles at the Mercury level (it even works in the asm grade),
but the java compilers complains of:
                                                                                                                                                                                   
Making Java class files
Mercury/java/x86_64-unknown-linux-gnu/Mercury/javas/jmercury/sewol.java:5471: inconvertible types
found : jmercury.runtime.TypeCtorInfo_Struct
required: java.lang.Object[]
      TypeClassInfo_for_workflow_case_238 = (/* typeclass_info */ java.lang.Object[]) unit.unit__type_ctor_info_unit_0;
                                                                                          ^
"
Additional InformationI haven't been able to pull a small test case from our tangled web of proprietary code yet.
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes

~0000247

wangp (developer)

I think I know where the bug is.

`interpret_typeclass_info_manipulator' in higher_order.m tries to evaluate
`private_builtin.superclass_from_typeclass_info' at compile time, but the
Index calculation is wrong.

`private_builtin.superclass_from_typeclass_info' calls
`MR_typeclass_info_superclass_info', defined in mercury_type_info.h:

  #define MR_typeclass_info_superclass_info(tci, n) \
    (((MR_Word *)(tci))[MR_typeclass_info_num_extra_instance_args(tci) + (n)])

where: "MR_typeclass_info_num_extra_instance_args gives the sum of
MR_typeclass_info_num_instance_type_vars and
MR_typeclass_info_num_instance_constraints".

But `interpret_typeclass_info_manipulator' only adds NumConstraints. I'm not
sure how to get MR_typeclass_info_num_instance_type_vars at compile time.
Somewhere in hlds_instance_defn?

The bug also affects type_info_from_typeclass_info.
+Notes

-Issue History
Date Modified Username Field Change
2010-01-18 11:50 wangp New Issue
2010-01-18 11:51 wangp Status new => assigned
2010-01-18 11:51 wangp Assigned To => wangp
2010-01-22 12:53 wangp Note Added: 0000247
2010-01-25 16:29 wangp Status assigned => resolved
2010-01-25 16:29 wangp Resolution open => fixed
+Issue History