Opened 14 years ago

Closed 10 years ago

#1308 closed defect (fixed)

Lookup of builtin functions is not implemented correctly

Reported by: Martin Sjölund Owned by: Martin Sjölund
Priority: high Milestone: Bootstrapping
Component: Instantiation Version:
Keywords: Cc: Martin Sjölund

Description

Even when calling a function P.identity, the builtin function has precedence. This is clearly wrong. Even though it would possibly make instantiation slower, we should consider builtin types only at the top-level scope. Shadowing builtin functions is used in OMC so this is needed for bootstrapping.

{{{package P

function identity

input String str;
output String o := str;

end identity;

end P;}}}

{{{P.identity("1");
getErrorString();}}}

{{{"Error: No matching function found for P.identity in component <NO COMPONENT>, candidates are function(x:Integer) => Integer[8]

-function(x:Integer) => Integer[7]
-function(x:Integer) => Integer[6]
-function(x:Integer) => Integer[5]
-function(x:Integer) => Integer[4]
-function(x:Integer) => Integer[3]
-function(x:Integer) => Integer[2]
-function(x:Integer) => Integer[1]

"
}}}

Change History (3)

comment:1 by Martin Sjölund, 14 years ago

Actually, calling P.identity(1), which is the valid builtin call, produced the empty string as result. Sadly, fixing this seems to add a few minutes to the testsuite.

comment:2 by Martin Sjölund, 14 years ago

I will (partially) fix this in my branch (so that P.identity cannot resolve to .identity). But I won't change elabCall (or all the isBuiltin/etc stuff we have in the compiler), which would be necessary to solve this properly.
The usage of Dump.identity has been removed from the branch as that is easier to do in order to bootstrap the compiler.

comment:3 by Martin Sjölund, 10 years ago

Cc: sjoelund.se, → sjoelund.se
Resolution: fixed
Status: acceptedclosed

This got a lot better over the years

Note: See TracTickets for help on using tickets.