forked from OSchip/llvm-project
[flang] Fix extended derived type kind compatibility check
`HaveCompatibleKindParameters` was not considering the kind parameters of the parent types leading to false answers. This change fixes this by directly looking into the map of `ParamValue` of the `DeclTypeSpec` instead of going through the symbols of the derived type scope. This map contains all the parent and implicit type parameters. Original-commit: flang-compiler/f18@cd5b976fc9 Reviewed-on: https://github.com/flang-compiler/f18/pull/615 Tree-same-pre-rewrite: false
This commit is contained in:
parent
c4e13f6be8
commit
ba7ed2722a
|
@ -151,14 +151,11 @@ bool DynamicType::IsTypeCompatibleWith(const DynamicType &that) const {
|
|||
// corresponding kind type parameters of the type2?
|
||||
static bool IsKindCompatible(const semantics::DerivedTypeSpec &type1,
|
||||
const semantics::DerivedTypeSpec &type2) {
|
||||
for (const auto &[name, symbol] : *type1.scope()) {
|
||||
if (const auto *details{symbol->detailsIf<semantics::TypeParamDetails>()}) {
|
||||
if (details->attr() == common::TypeParamAttr::Kind) {
|
||||
const semantics::ParamValue *param1{type1.FindParameter(name)};
|
||||
const semantics::ParamValue *param2{type2.FindParameter(name)};
|
||||
if (!PointeeComparison(param1, param2)) {
|
||||
return false;
|
||||
}
|
||||
for (const auto &[name, param1] : type1.parameters()) {
|
||||
if (param1.isKind()) {
|
||||
const semantics::ParamValue *param2{type2.FindParameter(name)};
|
||||
if (!PointeeComparison(¶m1, param2)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue