mirror of
https://github.com/AdaCore/langkit.git
synced 2026-02-12 12:28:12 -08:00
TypeSet: fix handling of abstract classes with no concrete subclasses
TN: S311-015
This commit is contained in:
committed by
Raphaël AMIARD
parent
0b8e7bd9ff
commit
53b2c7dac6
@@ -156,13 +156,22 @@ class TypeSet(object):
|
||||
for parent in reversed(parents):
|
||||
if not parent.abstract or parent in self.matched_types:
|
||||
break
|
||||
subclasses = set(parent.subclasses)
|
||||
|
||||
subclasses = set(parent.concrete_subclasses)
|
||||
if not subclasses.issubset(self.matched_types):
|
||||
break
|
||||
# If we reach this point, all parent's subclasses are matched,
|
||||
# so we can state that parent itself is always matched.
|
||||
|
||||
# If we reach this point, all parent's concrete subclasses are
|
||||
# matched, so we can state that parent itself is always matched.
|
||||
self.matched_types.add(parent)
|
||||
|
||||
# Also include subclasses: we may add abstract subclasses which
|
||||
# have no concrete subclasses themselves. Typically: the generic
|
||||
# list type (which is abstract) while there is no list in the
|
||||
# grammar.
|
||||
for s in parent.subclasses:
|
||||
self.include(s)
|
||||
|
||||
return False
|
||||
|
||||
def exclude(self, t):
|
||||
|
||||
Reference in New Issue
Block a user