C#: Use the fully qualified name for the extension type when printing extension types.

This commit is contained in:
Michael Nebel
2026-02-09 13:27:32 +01:00
parent fe94b3b68b
commit bcdbd6e283
2 changed files with 13 additions and 7 deletions

View File

@@ -67,6 +67,12 @@ module QualifiedName<QualifiedNameInputSig Input> {
)
}
private string getName(ValueOrRefType t) {
not t instanceof ExtensionType and result = t.getUndecoratedName()
or
result = "extension(" + getFullName(t.(ExtensionType).getExtendedType()) + ")"
}
/** Holds if declaration `d` has the qualified name `qualifier`.`name`. */
predicate hasQualifiedName(Declaration d, string qualifier, string name) {
d =
@@ -86,12 +92,12 @@ module QualifiedName<QualifiedNameInputSig Input> {
exists(string name0 | name = name0 + Input::getUnboundGenericSuffix(ugt) |
exists(string enclosing |
hasQualifiedName(ugt.getDeclaringType(), qualifier, enclosing) and
name0 = enclosing + "+" + ugt.getUndecoratedName()
name0 = enclosing + "+" + getName(ugt)
)
or
not exists(ugt.getDeclaringType()) and
qualifier = ugt.getNamespace().getFullName() and
name0 = ugt.getUndecoratedName()
name0 = getName(ugt)
)
)
or
@@ -100,12 +106,12 @@ module QualifiedName<QualifiedNameInputSig Input> {
exists(string name0 | name = name0 + "<" + getTypeArgumentsQualifiedNames(ct) + ">" |
exists(string enclosing |
hasQualifiedName(ct.getDeclaringType(), qualifier, enclosing) and
name0 = enclosing + "+" + ct.getUndecoratedName()
name0 = enclosing + "+" + getName(ct)
)
or
not exists(ct.getDeclaringType()) and
qualifier = ct.getNamespace().getFullName() and
name0 = ct.getUndecoratedName()
name0 = getName(ct)
)
)
or
@@ -116,12 +122,12 @@ module QualifiedName<QualifiedNameInputSig Input> {
(
exists(string enclosing |
hasQualifiedName(vort.getDeclaringType(), qualifier, enclosing) and
name = enclosing + "+" + vort.getUndecoratedName()
name = enclosing + "+" + getName(vort)
)
or
not exists(vort.getDeclaringType()) and
qualifier = vort.getNamespace().getFullName() and
name = vort.getUndecoratedName()
name = getName(vort)
)
)
or

View File

@@ -214,7 +214,7 @@ module ModelValidation {
not namespace.regexpMatch("[a-zA-Z0-9_\\.]+") and
result = "Dubious namespace \"" + namespace + "\" in " + pred + " model."
or
not type.regexpMatch("[a-zA-Z0-9_<>,\\(\\)\\+]+") and
not type.regexpMatch("[a-zA-Z0-9_<>,\\(\\)\\+\\.]+") and
result = "Dubious type \"" + type + "\" in " + pred + " model."
or
not name.regexpMatch("[a-zA-Z0-9_<>,\\.]*") and