You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
real:: r1, r2
...
! Loki knows it is a "generic" procedure, but that's all call swap(r1, r2)
Currently, in the CallStmt, loki points to a dtype with a procedure of DEFERED type. This PR adds capability of figuring out the concrete function really called (in some easy cases). The resolution mechanism tries to match parameters of each concrete function with arguments passed to the generic function call. Of course, the whole resolution is conservative (as everything in compilers! :D) and additional information is added only when everything matches.
The matching is based on the ExpressionDimensionsMapper and a new ExpressionTypeMapper which takes a piece of the AST and tries to deduce it's final type. This mapper is not very capable, it works well on typed variables, literals and some easy expressions (with sum op).
We weren't sure if we should populate the procedure with the concrete routine in the ProcedureType, so we have added an additional field concrete_procedure which points to the concrete procedure when a generic is used, and the normal procedure otherwise.
I am looking forward to your comments and the discussion of this feature.
Things to do:
Implementation for other parsers
More capable ExpressionTypeMapper
More unit tests
The text was updated successfully, but these errors were encountered:
This is only a proposal. A draft implementation has been prepared here: #340 .
One of the useful information missing in loki is the information about the real function being called when a generic interface is used:
Then, called somewhere else:
Currently, in the
CallStmt
, loki points to adtype
with a procedure of DEFERED type. This PR adds capability of figuring out the concrete function really called (in some easy cases). The resolution mechanism tries to match parameters of each concrete function with arguments passed to the generic function call. Of course, the whole resolution is conservative (as everything in compilers! :D) and additional information is added only when everything matches.The matching is based on the
ExpressionDimensionsMapper
and a newExpressionTypeMapper
which takes a piece of the AST and tries to deduce it's final type. This mapper is not very capable, it works well on typed variables, literals and some easy expressions (withsum
op).We weren't sure if we should populate the
procedure
with the concrete routine in theProcedureType
, so we have added an additional fieldconcrete_procedure
which points to the concrete procedure when a generic is used, and the normal procedure otherwise.I am looking forward to your comments and the discussion of this feature.
Things to do:
ExpressionTypeMapper
The text was updated successfully, but these errors were encountered: