[flang-commits] [PATCH] D119448: [flang] Handle "type(foo) function f" when foo is defined in f
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Thu Feb 10 08:45:18 PST 2022
klausler created this revision.
klausler added a reviewer: PeteSteinfeld.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
Herald added a reviewer: sscalpone.
klausler requested review of this revision.
Fortran allows forward references to derived types, including
function results that are typed in a prefix of a FUNCTION statement.
If a type is defined in the body of the function, a reference to
that type from a prefix on the FUNCTION statement must resolve to
the local symbol, even and especially when that type shadows one
from the host scope.
The solution is to defer the processing of that type until the
end of the function's specification part. But the language doesn't
allow for forward references to other names in the prefix, so defer
the processing of the type only when it is not an intrinsic type.
The data structures in name resolution that track this information
for functions needed to become a stack in order to make this work,
since functions can contain interfaces that are functions.
https://reviews.llvm.org/D119448
Files:
flang/lib/Evaluate/tools.cpp
flang/lib/Semantics/resolve-names.cpp
flang/test/Semantics/resolve108.f90
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119448.407553.patch
Type: text/x-patch
Size: 14466 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220210/e59e7a6f/attachment.bin>
More information about the flang-commits
mailing list