Getting stack trace from geant

爱⌒轻易说出口 提交于 2019-12-14 04:02:33

问题


I'm trying to compile a project (see this SO question) using Gobo compiler and its tools and I'm getting error messages refering to standard library equal(..). I'm sure that error is somewhere in the code I have and not in standard library but I don't know how to get some more info from geant. I'd like to know which class, function, line of code from my code invoked equal(..) or any other standard library function which might call it. And yes, I've already tried going through all equal(..)s in my code.

Error messages I get are like this:

[CATCALL] class SQL_GENERATOR_TSQL65 (ANY,95,8): type 'STRING_8' of actual argument #1 does not conform to type 'UC_STRING' of formal argument in feature `is_equal' in class 'UC_STRING'

This points to library\free_elks\src\elks\kernel\any.e:

    frozen equal (a: detachable ANY; b: like a): BOOLEAN
        -- Are `a' and `b' either both void or attached
        -- to objects considered equal?
    do
        if a = Void then
            Result := b = Void
        else
            Result := b /= Void and then
                        a.is_equal (b) -- <<<<<<< THIS LINE
        end
    ensure
        definition: Result = (a = Void and b = Void) or else
                    ((a /= Void and b /= Void) and then
                    a.is_equal (b))
    end

回答1:


Reported CAT-calls are system errors (as opposed to class errors), i.e. appear as a result of the whole system analysis. The class UC_STRING redefines the feature is_equal. As a result it can be used only with arguments of type UC_STRING (or its descendants).

Some code treats UC_STRING as STRING_8 (UC_STRING inherits from STRING_8). As soon as UC_STRING is attached to an entity of type STRING_8, the code is at risk of getting the CAT-call. Here is an example:

s: STRING_8
t: STRING_8
u: UC_STRING
...
s := u
if equal (s, t) then ...

The code of equal that you mention calls is_equal on an instance of UC_STRING, but receives STRING_8 as an argument. However, the version of is_equal in UC_STRING can handle only UC_STRING as an argument, not STRING_8. That's why you get the error.

The issue can be solved by

  • changing the argument type of is_equal in UC_STRING to accept STRING_8
  • removing all reattachments of UC_STRING to STRING_8
  • disabling the CAT-call errors

The last one seems to be the best in your case.



来源:https://stackoverflow.com/questions/47045431/getting-stack-trace-from-geant

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!