[flang] Fix instantiation of PDT bindings
Original-commit: flang-compiler/f18@8dcfe0c70b Reviewed-on: https://github.com/flang-compiler/f18/pull/271 Tree-same-pre-rewrite: false
This commit is contained in:
parent
ef77d38c21
commit
8c5d6b99de
2 changed files with 6 additions and 17 deletions
|
@ -249,6 +249,7 @@ const DeclTypeSpec &Scope::FindOrInstantiateDerivedType(DerivedTypeSpec &&spec,
|
|||
|
||||
void Scope::InstantiateDerivedType(
|
||||
Scope &clone, SemanticsContext &semanticsContext) const {
|
||||
CHECK(kind_ == Kind::DerivedType);
|
||||
clone.sourceRange_ = sourceRange_;
|
||||
clone.chars_ = chars_;
|
||||
for (const auto &pair : symbols_) {
|
||||
|
@ -275,15 +276,13 @@ const DeclTypeSpec &Scope::InstantiateIntrinsicType(
|
|||
kind = *value;
|
||||
} else {
|
||||
foldingContext.messages.Say(
|
||||
"KIND parameter value (%jd) of intrinsic type %s did not resolve to a supported value"_err_en_US,
|
||||
"KIND parameter value (%jd) of intrinsic type %s "
|
||||
"did not resolve to a supported value"_err_en_US,
|
||||
static_cast<std::intmax_t>(*value),
|
||||
parser::ToUpperCaseLetters(
|
||||
common::EnumToString(intrinsic->category()))
|
||||
.data());
|
||||
}
|
||||
} else {
|
||||
foldingContext.messages.Say(
|
||||
"KIND parameter value did not resolve to a constant value"_err_en_US);
|
||||
}
|
||||
switch (spec.category()) {
|
||||
case DeclTypeSpec::Numeric:
|
||||
|
|
|
@ -490,7 +490,7 @@ Symbol &Symbol::Instantiate(
|
|||
if (!pair.second) {
|
||||
// Symbol was already present in the scope, which can only happen
|
||||
// in the case of type parameters with actual or default values.
|
||||
get<TypeParamDetails>(); // confirm or crash with message
|
||||
CHECK(has<TypeParamDetails>());
|
||||
return symbol;
|
||||
}
|
||||
symbol.attrs_ = attrs_;
|
||||
|
@ -541,18 +541,8 @@ Symbol &Symbol::Instantiate(
|
|||
}
|
||||
// TODO: fold cobounds too once we can represent them
|
||||
},
|
||||
[&](const ProcBindingDetails &that) {
|
||||
symbol.details_ = ProcBindingDetails{
|
||||
that.symbol().Instantiate(scope, semanticsContext)};
|
||||
},
|
||||
[&](const GenericBindingDetails &that) {
|
||||
symbol.details_ = GenericBindingDetails{};
|
||||
GenericBindingDetails &details{symbol.get<GenericBindingDetails>()};
|
||||
for (const Symbol *sym : that.specificProcs()) {
|
||||
details.add_specificProc(
|
||||
sym->Instantiate(scope, semanticsContext));
|
||||
}
|
||||
},
|
||||
[&](const ProcBindingDetails &that) { symbol.details_ = that; },
|
||||
[&](const GenericBindingDetails &that) { symbol.details_ = that; },
|
||||
[&](const TypeParamDetails &that) {
|
||||
// LEN type parameter, or error recovery on a KIND type parameter
|
||||
// with no corresponding actual argument or default
|
||||
|
|
Loading…
Reference in a new issue