Skip to content

Commit

Permalink
Fixes incorrect field resolution in base classes (#1490)
Browse files Browse the repository at this point in the history
Due to a bug in the symbol resolver, we did not resolve fields that are in base classes of classes incorrectly
  • Loading branch information
oxisto authored and maximiliankaul committed Apr 17, 2024
1 parent 3caa91c commit a102bff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,8 @@ open class SymbolResolver(ctx: TranslationContext) : ComponentPass(ctx) {
if (member == null) {
member =
containingClass.superTypes
.flatMap { it.fields }
.filter { it.name.lastPartsMatch(reference.name) }
.flatMap { it.recordDeclaration?.fields ?: listOf() }
.filter { it.name.localName == reference.name.localName }
.map { it.definition }
.firstOrNull()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ open class TypeHierarchyResolver(ctx: TranslationContext) : ComponentPass(ctx) {
.mapNotNull { (it as? ObjectType)?.recordDeclaration }
.toSet()
recordDeclaration.superTypeDeclarations = superTypeDeclarations

// This will make sure that the type is correctly registered with the type system and that
// all the super types are set correctly
recordDeclaration.toType()

return superTypeDeclarations
}

Expand Down

0 comments on commit a102bff

Please sign in to comment.