[all-commits] [llvm/llvm-project] 93b063: [flang] Handle "type(foo) function f" when foo is ...
Peter Klausler via All-commits
all-commits at lists.llvm.org
Thu Feb 10 10:29:53 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 93b0638eff586fabb38c18e8bb34c89661e525e5
https://github.com/llvm/llvm-project/commit/93b0638eff586fabb38c18e8bb34c89661e525e5
Author: Peter Klausler <pklausler at nvidia.com>
Date: 2022-02-10 (Thu, 10 Feb 2022)
Changed paths:
M flang/lib/Evaluate/tools.cpp
M flang/lib/Semantics/resolve-names.cpp
A flang/test/Semantics/resolve108.f90
Log Message:
-----------
[flang] Handle "type(foo) function f" when foo is defined in f
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.
Differential Revision: https://reviews.llvm.org/D119448
More information about the All-commits
mailing list