diff --git a/go/downgrades/20cbf29a08034a40b49ab41c26f37a710de32857/explicit_aliases_downgrade.ql b/go/downgrades/20cbf29a08034a40b49ab41c26f37a710de32857/explicit_aliases_downgrade.ql new file mode 100644 index 000000000000..c47f5b426501 --- /dev/null +++ b/go/downgrades/20cbf29a08034a40b49ab41c26f37a710de32857/explicit_aliases_downgrade.ql @@ -0,0 +1,742 @@ +// BEGIN ALIASES.QLL +// Database scripts can't import, but this is the definitive copy of the support routines for mapping types to their unaliased equivalent. Ensure this code is in sync between aliases.qll and all copies in individual table .ql files. +/** A Go type. */ +class Type extends @type { + /** + * Gets this type with all aliases substituted for their underlying type. + * + * Note named types are not substituted. + */ + Type getDeepUnaliasedType() { result = this } + + /** + * Gets a basic textual representation of this type. + */ + string toString() { result = "type" } +} + +/** A composite type, that is, not a basic type. */ +class CompositeType extends @compositetype, Type { } + +/** An array type. */ +class ArrayType extends @arraytype, CompositeType { + /** Gets the element type of this array type. */ + Type getElementType() { element_type(this, result) } + + /** Gets the length of this array type as a string. */ + string getLengthString() { array_length(this, result) } + + override ArrayType getDeepUnaliasedType() { + result.getElementType() = this.getElementType().getDeepUnaliasedType() and + result.getLengthString() = this.getLengthString() + } +} + +/** A slice type. */ +class SliceType extends @slicetype, CompositeType { + /** Gets the element type of this slice type. */ + Type getElementType() { element_type(this, result) } + + override SliceType getDeepUnaliasedType() { + result.getElementType() = this.getElementType().getDeepUnaliasedType() + } +} + +// Improve efficiency of matching a struct to its unaliased equivalent +// by unpacking the first 5 fields and tags, allowing a single join +// to strongly constrain the available candidates. +private predicate hasComponentTypeAndTag(StructType s, int i, string name, Type tp, string tag) { + component_types(s, i, name, tp) and struct_tags(s, i, tag) +} + +private newtype TOptStructComponent = + MkNoComponent() or + MkSomeComponent(string name, Type tp, string tag) { hasComponentTypeAndTag(_, _, name, tp, tag) } + +private class OptStructComponent extends TOptStructComponent { + OptStructComponent getWithDeepUnaliasedType() { + this = MkNoComponent() and result = MkNoComponent() + or + exists(string name, Type tp, string tag | + this = MkSomeComponent(name, tp, tag) and + result = MkSomeComponent(name, tp.getDeepUnaliasedType(), tag) + ) + } + + string toString() { result = "struct component" } +} + +private class StructComponent extends MkSomeComponent { + string toString() { result = "struct component" } + + predicate isComponentOf(StructType s, int i) { + exists(string name, Type tp, string tag | + hasComponentTypeAndTag(s, i, name, tp, tag) and + this = MkSomeComponent(name, tp, tag) + ) + } +} + +pragma[nomagic] +predicate unpackStructType( + StructType s, TOptStructComponent c0, TOptStructComponent c1, TOptStructComponent c2, + TOptStructComponent c3, TOptStructComponent c4, int nComponents +) { + nComponents = count(int i | component_types(s, i, _, _)) and + ( + if nComponents >= 1 + then c0 = any(StructComponent sc | sc.isComponentOf(s, 0)) + else c0 = MkNoComponent() + ) and + ( + if nComponents >= 2 + then c1 = any(StructComponent sc | sc.isComponentOf(s, 1)) + else c1 = MkNoComponent() + ) and + ( + if nComponents >= 3 + then c2 = any(StructComponent sc | sc.isComponentOf(s, 2)) + else c2 = MkNoComponent() + ) and + ( + if nComponents >= 4 + then c3 = any(StructComponent sc | sc.isComponentOf(s, 3)) + else c3 = MkNoComponent() + ) and + ( + if nComponents >= 5 + then c4 = any(StructComponent sc | sc.isComponentOf(s, 4)) + else c4 = MkNoComponent() + ) +} + +pragma[nomagic] +predicate unpackAndUnaliasStructType( + StructType s, TOptStructComponent c0, TOptStructComponent c1, TOptStructComponent c2, + TOptStructComponent c3, TOptStructComponent c4, int nComponents +) { + exists( + OptStructComponent c0a, OptStructComponent c1a, OptStructComponent c2a, OptStructComponent c3a, + OptStructComponent c4a + | + unpackStructType(s, c0a, c1a, c2a, c3a, c4a, nComponents) and + c0 = c0a.getWithDeepUnaliasedType() and + c1 = c1a.getWithDeepUnaliasedType() and + c2 = c2a.getWithDeepUnaliasedType() and + c3 = c3a.getWithDeepUnaliasedType() and + c4 = c4a.getWithDeepUnaliasedType() + ) +} + +/** A struct type. */ +class StructType extends @structtype, CompositeType { + private StructType getDeepUnaliasedTypeCandidate() { + exists( + OptStructComponent c0, OptStructComponent c1, OptStructComponent c2, OptStructComponent c3, + OptStructComponent c4, int nComponents + | + unpackAndUnaliasStructType(this, c0, c1, c2, c3, c4, nComponents) and + unpackStructType(result, c0, c1, c2, c3, c4, nComponents) + ) + } + + private predicate isDeepUnaliasedTypeUpTo(StructType unaliased, int i) { + // Note we must use component_types not hasOwnField here because component_types may specify + // interface-in-struct embedding, but hasOwnField does not return such members. + unaliased = this.getDeepUnaliasedTypeCandidate() and + i >= 5 and + ( + i = 5 or + this.isDeepUnaliasedTypeUpTo(unaliased, i - 1) + ) and + exists(string name, Type tp, string tag | hasComponentTypeAndTag(this, i, name, tp, tag) | + hasComponentTypeAndTag(unaliased, i, name, tp.getDeepUnaliasedType(), tag) + ) + } + + override StructType getDeepUnaliasedType() { + result = this.getDeepUnaliasedTypeCandidate() and + exists(int nComponents | nComponents = count(int i | component_types(this, i, _, _)) | + this.isDeepUnaliasedTypeUpTo(result, nComponents - 1) + or + nComponents <= 5 + ) + } +} + +/** A pointer type. */ +class PointerType extends @pointertype, CompositeType { + /** Gets the base type of this pointer type. */ + Type getBaseType() { base_type(this, result) } + + override PointerType getDeepUnaliasedType() { + result.getBaseType() = this.getBaseType().getDeepUnaliasedType() + } +} + +private predicate isInterfaceComponentWithQualifiedName( + InterfaceType intf, int idx, string qualifiedName, Type tp +) { + exists(string name | component_types(intf, idx, name, tp) | + interface_private_method_ids(intf, idx, qualifiedName) + or + not interface_private_method_ids(intf, idx, _) and qualifiedName = name + ) +} + +private newtype TOptInterfaceComponent = + MkNoIComponent() or + MkSomeIComponent(string name, Type tp) { + isInterfaceComponentWithQualifiedName(any(InterfaceType i), _, name, tp) + } + +private class OptInterfaceComponent extends TOptInterfaceComponent { + OptInterfaceComponent getWithDeepUnaliasedType() { + this = MkNoIComponent() and result = MkNoIComponent() + or + exists(string name, Type tp | + this = MkSomeIComponent(name, tp) and + result = MkSomeIComponent(name, tp.getDeepUnaliasedType()) + ) + } + + string toString() { result = "interface component" } +} + +private class InterfaceComponent extends MkSomeIComponent { + string toString() { result = "interface component" } + + predicate isComponentOf(InterfaceType intf, int i) { + exists(string name, Type tp | + isInterfaceComponentWithQualifiedName(intf, i, name, tp) and + this = MkSomeIComponent(name, tp) + ) + } +} + +pragma[nomagic] +predicate unpackInterfaceType( + InterfaceType intf, TOptInterfaceComponent c0, TOptInterfaceComponent c1, + TOptInterfaceComponent c2, TOptInterfaceComponent c3, TOptInterfaceComponent c4, + TOptInterfaceComponent e1, TOptInterfaceComponent e2, int nComponents, int nEmbeds, + boolean isComparable +) { + nComponents = count(int i | isInterfaceComponentWithQualifiedName(intf, i, _, _) and i >= 0) and + nEmbeds = count(int i | isInterfaceComponentWithQualifiedName(intf, i, _, _) and i < 0) and + ( + if intf = any(ComparableType comparable).getBaseType() + then isComparable = true + else isComparable = false + ) and + ( + if nComponents >= 1 + then c0 = any(InterfaceComponent ic | ic.isComponentOf(intf, 0)) + else c0 = MkNoIComponent() + ) and + ( + if nComponents >= 2 + then c1 = any(InterfaceComponent ic | ic.isComponentOf(intf, 1)) + else c1 = MkNoIComponent() + ) and + ( + if nComponents >= 3 + then c2 = any(InterfaceComponent ic | ic.isComponentOf(intf, 2)) + else c2 = MkNoIComponent() + ) and + ( + if nComponents >= 4 + then c3 = any(InterfaceComponent ic | ic.isComponentOf(intf, 3)) + else c3 = MkNoIComponent() + ) and + ( + if nComponents >= 5 + then c4 = any(InterfaceComponent ic | ic.isComponentOf(intf, 4)) + else c4 = MkNoIComponent() + ) and + ( + if nEmbeds >= 1 + then e1 = any(InterfaceComponent ic | ic.isComponentOf(intf, -1)) + else e1 = MkNoIComponent() + ) and + ( + if nEmbeds >= 2 + then e2 = any(InterfaceComponent ic | ic.isComponentOf(intf, -2)) + else e2 = MkNoIComponent() + ) +} + +pragma[nomagic] +predicate unpackAndUnaliasInterfaceType( + InterfaceType intf, TOptInterfaceComponent c0, TOptInterfaceComponent c1, + TOptInterfaceComponent c2, TOptInterfaceComponent c3, TOptInterfaceComponent c4, + TOptInterfaceComponent e1, TOptInterfaceComponent e2, int nComponents, int nEmbeds, + boolean isComparable +) { + exists( + OptInterfaceComponent c0a, OptInterfaceComponent c1a, OptInterfaceComponent c2a, + OptInterfaceComponent c3a, OptInterfaceComponent c4a, OptInterfaceComponent e1a, + OptInterfaceComponent e2a + | + unpackInterfaceType(intf, c0a, c1a, c2a, c3a, c4a, e1a, e2a, nComponents, nEmbeds, isComparable) and + c0 = c0a.getWithDeepUnaliasedType() and + c1 = c1a.getWithDeepUnaliasedType() and + c2 = c2a.getWithDeepUnaliasedType() and + c3 = c3a.getWithDeepUnaliasedType() and + c4 = c4a.getWithDeepUnaliasedType() and + e1 = e1a.getWithDeepUnaliasedType() and + e2 = e2a.getWithDeepUnaliasedType() + ) +} + +/** An interface type. */ +class InterfaceType extends @interfacetype, CompositeType { + private Type getMethodType(int i, string name) { + i >= 0 and isInterfaceComponentWithQualifiedName(this, i, name, result) + } + + /** + * Holds if `tp` is a directly embedded type with index `index`. + * + * `tp` (or its underlying type) is either a type set literal type or an + * interface type. + */ + private predicate hasDirectlyEmbeddedType(int index, Type tp) { + index >= 0 and isInterfaceComponentWithQualifiedName(this, -(index + 1), _, tp) + } + + private InterfaceType getDeepUnaliasedTypeCandidate() { + exists( + OptInterfaceComponent c0, OptInterfaceComponent c1, OptInterfaceComponent c2, + OptInterfaceComponent c3, OptInterfaceComponent c4, OptInterfaceComponent e1, + OptInterfaceComponent e2, int nComponents, int nEmbeds, boolean isComparable + | + unpackAndUnaliasInterfaceType(this, c0, c1, c2, c3, c4, e1, e2, nComponents, nEmbeds, + isComparable) and + unpackInterfaceType(result, c0, c1, c2, c3, c4, e1, e2, nComponents, nEmbeds, isComparable) + ) + } + + private predicate hasDeepUnaliasedComponentTypesUpTo(InterfaceType unaliased, int i) { + unaliased = this.getDeepUnaliasedTypeCandidate() and + i >= 5 and + ( + i = 5 or + this.hasDeepUnaliasedComponentTypesUpTo(unaliased, i - 1) + ) and + exists(string name | + unaliased.getMethodType(i, name) = this.getMethodType(i, name).getDeepUnaliasedType() + ) + } + + private predicate hasDeepUnaliasedEmbeddedTypesUpTo(InterfaceType unaliased, int i) { + unaliased = this.getDeepUnaliasedTypeCandidate() and + i >= 2 and + ( + i = 2 or + this.hasDeepUnaliasedEmbeddedTypesUpTo(unaliased, i - 1) + ) and + exists(Type tp | this.hasDirectlyEmbeddedType(i, tp) | + unaliased.hasDirectlyEmbeddedType(i, tp.getDeepUnaliasedType()) + ) + } + + override InterfaceType getDeepUnaliasedType() { + result = this.getDeepUnaliasedTypeCandidate() and + exists(int nComponents | nComponents = count(int i | exists(this.getMethodType(i, _))) | + this.hasDeepUnaliasedComponentTypesUpTo(result, nComponents - 1) + or + nComponents <= 5 + ) and + exists(int nEmbeds | nEmbeds = count(int i | this.hasDirectlyEmbeddedType(i, _)) | + this.hasDeepUnaliasedEmbeddedTypesUpTo(result, nEmbeds - 1) + or + nEmbeds <= 2 + ) + } +} + +pragma[nomagic] +private predicate unpackTupleType( + TupleType tt, TOptType c0, TOptType c1, TOptType c2, int nComponents +) { + nComponents = count(int i | component_types(tt, i, _, _)) and + (if nComponents >= 1 then c0 = MkSomeType(tt.getComponentType(0)) else c0 = MkNoType()) and + (if nComponents >= 2 then c1 = MkSomeType(tt.getComponentType(1)) else c1 = MkNoType()) and + (if nComponents >= 3 then c2 = MkSomeType(tt.getComponentType(2)) else c2 = MkNoType()) +} + +pragma[nomagic] +private predicate unpackAndUnaliasTupleType( + TupleType tt, TOptType c0, TOptType c1, TOptType c2, int nComponents +) { + exists(OptType c0a, OptType c1a, OptType c2a | + unpackTupleType(tt, c0a, c1a, c2a, nComponents) and + c0 = c0a.getDeepUnaliasedType() and + c1 = c1a.getDeepUnaliasedType() and + c2 = c2a.getDeepUnaliasedType() + ) +} + +/** A tuple type. */ +class TupleType extends @tupletype, CompositeType { + /** Gets the `i`th component type of this tuple type. */ + Type getComponentType(int i) { component_types(this, i, _, result) } + + private TupleType getCandidateDeepUnaliasedType() { + exists(OptType c0, OptType c1, OptType c2, int nComponents | + unpackAndUnaliasTupleType(this, c0, c1, c2, nComponents) and + unpackTupleType(result, c0, c1, c2, nComponents) + ) + } + + private predicate isDeepUnaliasedTypeUpTo(TupleType tt, int i) { + tt = this.getCandidateDeepUnaliasedType() and + i >= 3 and + ( + i = 3 + or + this.isDeepUnaliasedTypeUpTo(tt, i - 1) + ) and + tt.getComponentType(i) = this.getComponentType(i).getDeepUnaliasedType() + } + + override TupleType getDeepUnaliasedType() { + result = this.getCandidateDeepUnaliasedType() and + exists(int nComponents | nComponents = count(int i | component_types(this, i, _, _)) | + this.isDeepUnaliasedTypeUpTo(result, nComponents - 1) + or + nComponents <= 3 + ) + } +} + +// Reasonably efficiently map from a signature type to its +// deep-unaliased equivalent, by using a single join for the leading 5 parameters +// and/or 3 results. +private newtype TOptType = + MkNoType() or + MkSomeType(Type tp) + +private class OptType extends TOptType { + OptType getDeepUnaliasedType() { + exists(Type t | this = MkSomeType(t) | result = MkSomeType(t.getDeepUnaliasedType())) + or + this = MkNoType() and result = MkNoType() + } + + string toString() { + exists(Type t | this = MkSomeType(t) | result = t.toString()) + or + this = MkNoType() and result = "no type" + } +} + +pragma[nomagic] +private predicate unpackSignatureType( + SignatureType sig, OptType param0, OptType param1, OptType param2, OptType param3, OptType param4, + int nParams, OptType result0, OptType result1, OptType result2, int nResults, boolean isVariadic +) { + nParams = sig.getNumParameter() and + nResults = sig.getNumResult() and + (if nParams >= 1 then param0 = MkSomeType(sig.getParameterType(0)) else param0 = MkNoType()) and + (if nParams >= 2 then param1 = MkSomeType(sig.getParameterType(1)) else param1 = MkNoType()) and + (if nParams >= 3 then param2 = MkSomeType(sig.getParameterType(2)) else param2 = MkNoType()) and + (if nParams >= 4 then param3 = MkSomeType(sig.getParameterType(3)) else param3 = MkNoType()) and + (if nParams >= 5 then param4 = MkSomeType(sig.getParameterType(4)) else param4 = MkNoType()) and + (if nResults >= 1 then result0 = MkSomeType(sig.getResultType(0)) else result0 = MkNoType()) and + (if nResults >= 2 then result1 = MkSomeType(sig.getResultType(1)) else result1 = MkNoType()) and + (if nResults >= 3 then result2 = MkSomeType(sig.getResultType(2)) else result2 = MkNoType()) and + (if sig.isVariadic() then isVariadic = true else isVariadic = false) +} + +pragma[nomagic] +private predicate unpackAndUnaliasSignatureType( + SignatureType sig, OptType param0, OptType param1, OptType param2, OptType param3, OptType param4, + int nParams, OptType result0, OptType result1, OptType result2, int nResults, boolean isVariadic +) { + exists( + OptType param0a, OptType param1a, OptType param2a, OptType param3a, OptType param4a, + OptType result0a, OptType result1a, OptType result2a + | + unpackSignatureType(sig, param0a, param1a, param2a, param3a, param4a, nParams, result0a, + result1a, result2a, nResults, isVariadic) + | + param0 = param0a.getDeepUnaliasedType() and + param1 = param1a.getDeepUnaliasedType() and + param2 = param2a.getDeepUnaliasedType() and + param3 = param3a.getDeepUnaliasedType() and + param4 = param4a.getDeepUnaliasedType() and + result0 = result0a.getDeepUnaliasedType() and + result1 = result1a.getDeepUnaliasedType() and + result2 = result2a.getDeepUnaliasedType() + ) +} + +/** A signature type. */ +class SignatureType extends @signaturetype, CompositeType { + /** Gets the `i`th parameter type of this signature type. */ + Type getParameterType(int i) { i >= 0 and component_types(this, i + 1, _, result) } + + /** Gets the `i`th result type of this signature type. */ + Type getResultType(int i) { i >= 0 and component_types(this, -(i + 1), _, result) } + + /** Gets the number of parameters specified by this signature. */ + int getNumParameter() { result = count(int i | exists(this.getParameterType(i))) } + + /** Gets the number of results specified by this signature. */ + int getNumResult() { result = count(int i | exists(this.getResultType(i))) } + + /** Holds if this signature type is variadic. */ + predicate isVariadic() { variadic(this) } + + private SignatureType getDeepUnaliasedTypeCandidate() { + exists( + OptType param0, OptType param1, OptType param2, OptType param3, OptType param4, int nParams, + OptType result0, OptType result1, OptType result2, int nResults, boolean isVariadic + | + unpackAndUnaliasSignatureType(this, param0, param1, param2, param3, param4, nParams, result0, + result1, result2, nResults, isVariadic) and + unpackSignatureType(result, param0, param1, param2, param3, param4, nParams, result0, result1, + result2, nResults, isVariadic) + ) + } + + // These incremental recursive implementations only apply from parameter 5 or result 3 + // upwards to avoid constructing large squares of candidates -- the initial parameters + // and results are taken care of by the candidate predicate. + private predicate hasDeepUnaliasedParameterTypesUpTo(SignatureType unaliased, int i) { + unaliased = this.getDeepUnaliasedTypeCandidate() and + i >= 5 and + (i = 5 or this.hasDeepUnaliasedParameterTypesUpTo(unaliased, i - 1)) and + unaliased.getParameterType(i) = this.getParameterType(i).getDeepUnaliasedType() + } + + private predicate hasDeepUnaliasedResultTypesUpTo(SignatureType unaliased, int i) { + unaliased = this.getDeepUnaliasedTypeCandidate() and + i >= 3 and + (i = 3 or this.hasDeepUnaliasedResultTypesUpTo(unaliased, i - 1)) and + unaliased.getResultType(i) = this.getResultType(i).getDeepUnaliasedType() + } + + override SignatureType getDeepUnaliasedType() { + result = this.getDeepUnaliasedTypeCandidate() and + exists(int nParams, int nResults | + this.getNumParameter() = nParams and this.getNumResult() = nResults + | + ( + nParams <= 5 + or + this.hasDeepUnaliasedParameterTypesUpTo(result, nParams - 1) + ) and + ( + nResults <= 3 + or + this.hasDeepUnaliasedResultTypesUpTo(result, nResults - 1) + ) + ) + } +} + +/** A map type. */ +class MapType extends @maptype, CompositeType { + /** Gets the key type of this map type. */ + Type getKeyType() { key_type(this, result) } + + /** Gets the value type of this map type. */ + Type getValueType() { element_type(this, result) } + + override MapType getDeepUnaliasedType() { + result.getKeyType() = this.getKeyType().getDeepUnaliasedType() and + result.getValueType() = this.getValueType().getDeepUnaliasedType() + } +} + +/** A channel type. */ +class ChanType extends @chantype, CompositeType { + /** Gets the element type of this channel type. */ + Type getElementType() { element_type(this, result) } +} + +/** A channel type that can only send. */ +class SendChanType extends @sendchantype, ChanType { + override SendChanType getDeepUnaliasedType() { + result.getElementType() = this.getElementType().getDeepUnaliasedType() + } +} + +/** A channel type that can only receive. */ +class RecvChanType extends @recvchantype, ChanType { + override RecvChanType getDeepUnaliasedType() { + result.getElementType() = this.getElementType().getDeepUnaliasedType() + } +} + +/** A channel type that can both send and receive. */ +class SendRecvChanType extends @sendrcvchantype, ChanType { + override SendRecvChanType getDeepUnaliasedType() { + result.getElementType() = this.getElementType().getDeepUnaliasedType() + } +} + +/** A named type. */ +class NamedType extends @namedtype, CompositeType { + Type getBaseType() { underlying_type(this, result) } +} + +/** + * The predeclared `comparable` type. + */ +class ComparableType extends NamedType { + ComparableType() { typename(this, "comparable") } +} + +/** An alias type. */ +class AliasType extends @typealias, CompositeType { + /** Gets the aliased type (i.e. that appears on the RHS of the alias definition). */ + Type getRhs() { alias_rhs(this, result) } + + override Type getDeepUnaliasedType() { result = unalias(this).getDeepUnaliasedType() } +} + +/** + * Gets the non-alias type at the end of the alias chain starting at `t`. + * + * If `t` is not an alias type then `result` is `t`. + */ +Type unalias(Type t) { + not t instanceof AliasType and result = t + or + result = unalias(t.(AliasType).getRhs()) +} + +predicate containsAliases(Type t) { t != t.getDeepUnaliasedType() } + +class Object extends @object { + string toString() { result = "object" } +} + +class Ident extends @ident { + string toString() { result = "identifier" } +} + +class Expr extends @expr { + string toString() { result = "expr" } +} + +class TypeParamType extends @typeparamtype { + string toString() { result = "type parameter" } +} + +class TypeParamParentObject extends @typeparamparentobject { + string toString() { result = "type parameter parent object" } +} + +// Redirect references to e.g. a struct field `x MyInt` +// onto the corresponding field `x int` of the unaliased type. +Object getReplacementField(Object o) { + exists(StructType st, StructType unaliasedSt, string name | + fieldstructs(o, st) and + unaliasedSt = st.getDeepUnaliasedType() and + objects(o, _, name) and + fieldstructs(result, unaliasedSt) and + objects(result, _, name) + ) +} + +query predicate new_array_length(ArrayType at, string length) { + array_length(at, length) and + not containsAliases(at) +} + +query predicate new_base_type(PointerType pt, Type base) { + base_type(pt, base) and + not containsAliases(pt) +} + +query predicate new_component_types(CompositeType ct, int i, string name, Type tp) { + component_types(ct, i, name, tp) and + not containsAliases(ct) +} + +query predicate new_defs(Ident i, Object replacementO) { + exists(Object o | defs(i, o) | + replacementO = getReplacementField(o) + or + not exists(getReplacementField(o)) and replacementO = o + ) +} + +query predicate new_element_type(CompositeType ct, Type et) { + element_type(ct, et) and + not containsAliases(ct) +} + +query predicate new_fieldstructs(Object field, StructType st) { + fieldstructs(field, st) and + not containsAliases(st) +} + +query predicate new_key_type(MapType mt, Type kt) { + key_type(mt, kt) and + not containsAliases(mt) +} + +query predicate new_objects(Object o, int kind, string name) { + objects(o, kind, name) and + not exists(StructType st | fieldstructs(o, st) and containsAliases(st)) +} + +query predicate new_objecttypes(Object o, Type newT) { + exists(Type t | + objecttypes(o, t) and + not exists(StructType st | fieldstructs(o, st) and containsAliases(st)) + | + // Note this means that type aliases really do have an object in the new database; + // they just have types that resolve to the target of the alias, not the alias itself. + newT = t.getDeepUnaliasedType() + ) +} + +query predicate new_type_objects(Type type, Object object) { + type_objects(type, object) and + not containsAliases(type) +} + +query predicate new_type_of(Expr e, Type newT) { + exists(Type t | type_of(e, t) | newT = t.getDeepUnaliasedType()) +} + +query predicate new_typename(Type type, string name) { + typename(type, name) and + not containsAliases(type) +} + +query predicate new_typeparam( + TypeParamType tp, string name, CompositeType newBound, TypeParamParentObject parent, int idx +) { + exists(Type bound | typeparam(tp, name, bound, parent, idx) | + newBound = bound.getDeepUnaliasedType() + ) +} + +query predicate new_types(Type t, int kind) { + types(t, kind) and + not containsAliases(t) +} + +query predicate new_underlying_type(NamedType nt, Type newUnderlyingType) { + exists(Type ut | underlying_type(nt, ut) | newUnderlyingType = ut.getDeepUnaliasedType()) +} + +query predicate new_uses(Ident i, Object replacementO) { + exists(Object o | uses(i, o) | + replacementO = getReplacementField(o) + or + not exists(getReplacementField(o)) and replacementO = o + ) +} + +query predicate new_variadic(Type t) { + variadic(t) and + not containsAliases(t) +} diff --git a/go/downgrades/20cbf29a08034a40b49ab41c26f37a710de32857/go.dbscheme b/go/downgrades/20cbf29a08034a40b49ab41c26f37a710de32857/go.dbscheme new file mode 100644 index 000000000000..4bd57e093275 --- /dev/null +++ b/go/downgrades/20cbf29a08034a40b49ab41c26f37a710de32857/go.dbscheme @@ -0,0 +1,552 @@ +/** Auto-generated dbscheme; do not edit. Run `make gen` in directory `go/` to regenerate. */ + + +/** Duplicate code **/ + +duplicateCode( + unique int id : @duplication, + varchar(900) relativePath : string ref, + int equivClass : int ref); + +similarCode( + unique int id : @similarity, + varchar(900) relativePath : string ref, + int equivClass : int ref); + +@duplication_or_similarity = @duplication | @similarity; + +tokens( + int id : @duplication_or_similarity ref, + int offset : int ref, + int beginLine : int ref, + int beginColumn : int ref, + int endLine : int ref, + int endColumn : int ref); + +/** External data **/ + +externalData( + int id : @externalDataElement, + varchar(900) path : string ref, + int column: int ref, + varchar(900) value : string ref +); + +snapshotDate(unique date snapshotDate : date ref); + +sourceLocationPrefix(varchar(900) prefix : string ref); + + +/* + * XML Files + */ + +xmlEncoding( + unique int id: @file ref, + string encoding: string ref +); + +xmlDTDs( + unique int id: @xmldtd, + string root: string ref, + string publicId: string ref, + string systemId: string ref, + int fileid: @file ref +); + +xmlElements( + unique int id: @xmlelement, + string name: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int fileid: @file ref +); + +xmlAttrs( + unique int id: @xmlattribute, + int elementid: @xmlelement ref, + string name: string ref, + string value: string ref, + int idx: int ref, + int fileid: @file ref +); + +xmlNs( + int id: @xmlnamespace, + string prefixName: string ref, + string URI: string ref, + int fileid: @file ref +); + +xmlHasNs( + int elementId: @xmlnamespaceable ref, + int nsId: @xmlnamespace ref, + int fileid: @file ref +); + +xmlComments( + unique int id: @xmlcomment, + string text: string ref, + int parentid: @xmlparent ref, + int fileid: @file ref +); + +xmlChars( + unique int id: @xmlcharacters, + string text: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int isCDATA: int ref, + int fileid: @file ref +); + +@xmlparent = @file | @xmlelement; +@xmlnamespaceable = @xmlelement | @xmlattribute; + +xmllocations( + int xmlElement: @xmllocatable ref, + int location: @location_default ref +); + +@xmllocatable = @xmlcharacters | @xmlelement | @xmlcomment | @xmlattribute | @xmldtd | @file | @xmlnamespace; + +compilations(unique int id: @compilation, string cwd: string ref); + +#keyset[id, num] +compilation_args(int id: @compilation ref, int num: int ref, string arg: string ref); + +#keyset[id, num, kind] +compilation_time(int id: @compilation ref, int num: int ref, int kind: int ref, float secs: float ref); + +diagnostic_for(unique int diagnostic: @diagnostic ref, int compilation: @compilation ref, int file_number: int ref, int file_number_diagnostic_number: int ref); + +compilation_finished(unique int id: @compilation ref, float cpu_seconds: float ref, float elapsed_seconds: float ref); + +#keyset[id, num] +compilation_compiling_files(int id: @compilation ref, int num: int ref, int file: @file ref); + +diagnostics(unique int id: @diagnostic, int severity: int ref, string error_tag: string ref, string error_message: string ref, + string full_error_message: string ref, int location: @location ref); + +locations_default(unique int id: @location_default, int file: @file ref, int beginLine: int ref, int beginColumn: int ref, + int endLine: int ref, int endColumn: int ref); + +numlines(int element_id: @sourceline ref, int num_lines: int ref, int num_code: int ref, int num_comment: int ref); + +files(unique int id: @file, string name: string ref); + +folders(unique int id: @folder, string name: string ref); + +containerparent(int parent: @container ref, unique int child: @container ref); + +has_location(unique int locatable: @locatable ref, int location: @location ref); + +#keyset[parent, idx] +comment_groups(unique int id: @comment_group, int parent: @file ref, int idx: int ref); + +comments(unique int id: @comment, int kind: int ref, int parent: @comment_group ref, int idx: int ref, string text: string ref); + +doc_comments(unique int node: @documentable ref, int comment: @comment_group ref); + +#keyset[parent, idx] +exprs(unique int id: @expr, int kind: int ref, int parent: @exprparent ref, int idx: int ref); + +literals(unique int expr: @expr ref, string value: string ref, string raw: string ref); + +constvalues(unique int expr: @expr ref, string value: string ref, string exact: string ref); + +fields(unique int id: @field, int parent: @fieldparent ref, int idx: int ref); + +typeparamdecls(unique int id: @typeparamdecl, int parent: @typeparamdeclparent ref, int idx: int ref); + +#keyset[parent, idx] +stmts(unique int id: @stmt, int kind: int ref, int parent: @stmtparent ref, int idx: int ref); + +#keyset[parent, idx] +decls(unique int id: @decl, int kind: int ref, int parent: @declparent ref, int idx: int ref); + +#keyset[parent, idx] +specs(unique int id: @spec, int kind: int ref, int parent: @gendecl ref, int idx: int ref); + +scopes(unique int id: @scope, int kind: int ref); + +scopenesting(unique int inner: @scope ref, int outer: @scope ref); + +scopenodes(unique int node: @scopenode ref, int scope: @localscope ref); + +objects(unique int id: @object, int kind: int ref, string name: string ref); + +objectscopes(unique int object: @object ref, int scope: @scope ref); + +objecttypes(unique int object: @object ref, int tp: @type ref); + +methodreceivers(unique int method: @object ref, int receiver: @object ref); + +fieldstructs(unique int field: @object ref, int struct: @structtype ref); + +methodhosts(int method: @object ref, int host: @namedtype ref); + +defs(int ident: @ident ref, int object: @object ref); + +uses(int ident: @ident ref, int object: @object ref); + +types(unique int id: @type, int kind: int ref); + +type_of(unique int expr: @expr ref, int tp: @type ref); + +typename(unique int tp: @type ref, string name: string ref); + +key_type(unique int map: @maptype ref, int tp: @type ref); + +element_type(unique int container: @containertype ref, int tp: @type ref); + +base_type(unique int ptr: @pointertype ref, int tp: @type ref); + +underlying_type(unique int named: @namedtype ref, int tp: @type ref); + +#keyset[parent, index] +component_types(int parent: @compositetype ref, int index: int ref, string name: string ref, int tp: @type ref); + +#keyset[parent, index] +struct_tags(int parent: @structtype ref, int index: int ref, string tag: string ref); + +#keyset[interface, index] +interface_private_method_ids(int interface: @interfacetype ref, int index: int ref, string id: string ref); + +array_length(unique int tp: @arraytype ref, string len: string ref); + +type_objects(unique int tp: @type ref, int object: @object ref); + +packages(unique int id: @package, string name: string ref, string path: string ref, int scope: @packagescope ref); + +#keyset[parent, idx] +modexprs(unique int id: @modexpr, int kind: int ref, int parent: @modexprparent ref, int idx: int ref); + +#keyset[parent, idx] +modtokens(string token: string ref, int parent: @modexpr ref, int idx: int ref); + +#keyset[package, idx] +errors(unique int id: @error, int kind: int ref, string msg: string ref, string rawpos: string ref, + string file: string ref, int line: int ref, int col: int ref, int package: @package ref, int idx: int ref); + +has_ellipsis(int id: @callorconversionexpr ref); + +variadic(int id: @signaturetype ref); + +#keyset[parent, idx] +typeparam(unique int tp: @typeparamtype ref, string name: string ref, int bound: @compositetype ref, + int parent: @typeparamparentobject ref, int idx: int ref); + +@container = @file | @folder; + +@locatable = @xmllocatable | @node | @localscope; + +@node = @documentable | @exprparent | @modexprparent | @fieldparent | @stmtparent | @declparent | @typeparamdeclparent + | @scopenode | @comment_group | @comment; + +@documentable = @file | @field | @typeparamdecl | @spec | @gendecl | @funcdecl | @modexpr; + +@exprparent = @funcdef | @file | @expr | @field | @stmt | @decl | @typeparamdecl | @spec; + +@modexprparent = @file | @modexpr; + +@fieldparent = @decl | @structtypeexpr | @functypeexpr | @interfacetypeexpr; + +@stmtparent = @funcdef | @stmt | @decl; + +@declparent = @file | @declstmt; + +@typeparamdeclparent = @funcdecl | @typespec; + +@funcdef = @funclit | @funcdecl; + +@scopenode = @file | @functypeexpr | @blockstmt | @ifstmt | @caseclause | @switchstmt | @commclause | @loopstmt; + +@location = @location_default; + +@sourceline = @locatable; + +case @comment.kind of + 0 = @slashslashcomment +| 1 = @slashstarcomment; + +case @expr.kind of + 0 = @badexpr +| 1 = @ident +| 2 = @ellipsis +| 3 = @intlit +| 4 = @floatlit +| 5 = @imaglit +| 6 = @charlit +| 7 = @stringlit +| 8 = @funclit +| 9 = @compositelit +| 10 = @parenexpr +| 11 = @selectorexpr +| 12 = @indexexpr +| 13 = @genericfunctioninstantiationexpr +| 14 = @generictypeinstantiationexpr +| 15 = @sliceexpr +| 16 = @typeassertexpr +| 17 = @callorconversionexpr +| 18 = @starexpr +| 19 = @keyvalueexpr +| 20 = @arraytypeexpr +| 21 = @structtypeexpr +| 22 = @functypeexpr +| 23 = @interfacetypeexpr +| 24 = @maptypeexpr +| 25 = @typesetliteralexpr +| 26 = @plusexpr +| 27 = @minusexpr +| 28 = @notexpr +| 29 = @complementexpr +| 30 = @derefexpr +| 31 = @addressexpr +| 32 = @arrowexpr +| 33 = @lorexpr +| 34 = @landexpr +| 35 = @eqlexpr +| 36 = @neqexpr +| 37 = @lssexpr +| 38 = @leqexpr +| 39 = @gtrexpr +| 40 = @geqexpr +| 41 = @addexpr +| 42 = @subexpr +| 43 = @orexpr +| 44 = @xorexpr +| 45 = @mulexpr +| 46 = @quoexpr +| 47 = @remexpr +| 48 = @shlexpr +| 49 = @shrexpr +| 50 = @andexpr +| 51 = @andnotexpr +| 52 = @sendchantypeexpr +| 53 = @recvchantypeexpr +| 54 = @sendrcvchantypeexpr; + +@basiclit = @intlit | @floatlit | @imaglit | @charlit | @stringlit; + +@operatorexpr = @logicalexpr | @arithmeticexpr | @bitwiseexpr | @unaryexpr | @binaryexpr; + +@logicalexpr = @logicalunaryexpr | @logicalbinaryexpr; + +@arithmeticexpr = @arithmeticunaryexpr | @arithmeticbinaryexpr; + +@bitwiseexpr = @bitwiseunaryexpr | @bitwisebinaryexpr; + +@unaryexpr = @logicalunaryexpr | @bitwiseunaryexpr | @arithmeticunaryexpr | @derefexpr | @addressexpr | @arrowexpr; + +@logicalunaryexpr = @notexpr; + +@bitwiseunaryexpr = @complementexpr; + +@arithmeticunaryexpr = @plusexpr | @minusexpr; + +@binaryexpr = @logicalbinaryexpr | @bitwisebinaryexpr | @arithmeticbinaryexpr | @comparison; + +@logicalbinaryexpr = @lorexpr | @landexpr; + +@bitwisebinaryexpr = @shiftexpr | @orexpr | @xorexpr | @andexpr | @andnotexpr; + +@arithmeticbinaryexpr = @addexpr | @subexpr | @mulexpr | @quoexpr | @remexpr; + +@shiftexpr = @shlexpr | @shrexpr; + +@comparison = @equalitytest | @relationalcomparison; + +@equalitytest = @eqlexpr | @neqexpr; + +@relationalcomparison = @lssexpr | @leqexpr | @gtrexpr | @geqexpr; + +@chantypeexpr = @sendchantypeexpr | @recvchantypeexpr | @sendrcvchantypeexpr; + +case @stmt.kind of + 0 = @badstmt +| 1 = @declstmt +| 2 = @emptystmt +| 3 = @labeledstmt +| 4 = @exprstmt +| 5 = @sendstmt +| 6 = @incstmt +| 7 = @decstmt +| 8 = @gostmt +| 9 = @deferstmt +| 10 = @returnstmt +| 11 = @breakstmt +| 12 = @continuestmt +| 13 = @gotostmt +| 14 = @fallthroughstmt +| 15 = @blockstmt +| 16 = @ifstmt +| 17 = @caseclause +| 18 = @exprswitchstmt +| 19 = @typeswitchstmt +| 20 = @commclause +| 21 = @selectstmt +| 22 = @forstmt +| 23 = @rangestmt +| 24 = @assignstmt +| 25 = @definestmt +| 26 = @addassignstmt +| 27 = @subassignstmt +| 28 = @mulassignstmt +| 29 = @quoassignstmt +| 30 = @remassignstmt +| 31 = @andassignstmt +| 32 = @orassignstmt +| 33 = @xorassignstmt +| 34 = @shlassignstmt +| 35 = @shrassignstmt +| 36 = @andnotassignstmt; + +@incdecstmt = @incstmt | @decstmt; + +@assignment = @simpleassignstmt | @compoundassignstmt; + +@simpleassignstmt = @assignstmt | @definestmt; + +@compoundassignstmt = @addassignstmt | @subassignstmt | @mulassignstmt | @quoassignstmt | @remassignstmt + | @andassignstmt | @orassignstmt | @xorassignstmt | @shlassignstmt | @shrassignstmt | @andnotassignstmt; + +@branchstmt = @breakstmt | @continuestmt | @gotostmt | @fallthroughstmt; + +@switchstmt = @exprswitchstmt | @typeswitchstmt; + +@loopstmt = @forstmt | @rangestmt; + +case @decl.kind of + 0 = @baddecl +| 1 = @importdecl +| 2 = @constdecl +| 3 = @typedecl +| 4 = @vardecl +| 5 = @funcdecl; + +@gendecl = @importdecl | @constdecl | @typedecl | @vardecl; + +case @spec.kind of + 0 = @importspec +| 1 = @valuespec +| 2 = @typedefspec +| 3 = @aliasspec; + +@typespec = @typedefspec | @aliasspec; + +case @object.kind of + 0 = @pkgobject +| 1 = @decltypeobject +| 2 = @builtintypeobject +| 3 = @declconstobject +| 4 = @builtinconstobject +| 5 = @declvarobject +| 6 = @declfunctionobject +| 7 = @builtinfunctionobject +| 8 = @labelobject; + +@typeparamparentobject = @decltypeobject | @declfunctionobject; + +@declobject = @decltypeobject | @declconstobject | @declvarobject | @declfunctionobject; + +@builtinobject = @builtintypeobject | @builtinconstobject | @builtinfunctionobject; + +@typeobject = @decltypeobject | @builtintypeobject; + +@valueobject = @constobject | @varobject | @functionobject; + +@constobject = @declconstobject | @builtinconstobject; + +@varobject = @declvarobject; + +@functionobject = @declfunctionobject | @builtinfunctionobject; + +case @scope.kind of + 0 = @universescope +| 1 = @packagescope +| 2 = @localscope; + +case @type.kind of + 0 = @invalidtype +| 1 = @boolexprtype +| 2 = @inttype +| 3 = @int8type +| 4 = @int16type +| 5 = @int32type +| 6 = @int64type +| 7 = @uinttype +| 8 = @uint8type +| 9 = @uint16type +| 10 = @uint32type +| 11 = @uint64type +| 12 = @uintptrtype +| 13 = @float32type +| 14 = @float64type +| 15 = @complex64type +| 16 = @complex128type +| 17 = @stringexprtype +| 18 = @unsafepointertype +| 19 = @boolliteraltype +| 20 = @intliteraltype +| 21 = @runeliteraltype +| 22 = @floatliteraltype +| 23 = @complexliteraltype +| 24 = @stringliteraltype +| 25 = @nilliteraltype +| 26 = @typeparamtype +| 27 = @arraytype +| 28 = @slicetype +| 29 = @structtype +| 30 = @pointertype +| 31 = @interfacetype +| 32 = @tupletype +| 33 = @signaturetype +| 34 = @maptype +| 35 = @sendchantype +| 36 = @recvchantype +| 37 = @sendrcvchantype +| 38 = @namedtype +| 39 = @typesetliteraltype; + +@basictype = @booltype | @numerictype | @stringtype | @literaltype | @invalidtype | @unsafepointertype; + +@booltype = @boolexprtype | @boolliteraltype; + +@numerictype = @integertype | @floattype | @complextype; + +@integertype = @signedintegertype | @unsignedintegertype; + +@signedintegertype = @inttype | @int8type | @int16type | @int32type | @int64type | @intliteraltype | @runeliteraltype; + +@unsignedintegertype = @uinttype | @uint8type | @uint16type | @uint32type | @uint64type | @uintptrtype; + +@floattype = @float32type | @float64type | @floatliteraltype; + +@complextype = @complex64type | @complex128type | @complexliteraltype; + +@stringtype = @stringexprtype | @stringliteraltype; + +@literaltype = @boolliteraltype | @intliteraltype | @runeliteraltype | @floatliteraltype | @complexliteraltype + | @stringliteraltype | @nilliteraltype; + +@compositetype = @typeparamtype | @containertype | @structtype | @pointertype | @interfacetype | @tupletype + | @signaturetype | @namedtype | @typesetliteraltype; + +@containertype = @arraytype | @slicetype | @maptype | @chantype; + +@chantype = @sendchantype | @recvchantype | @sendrcvchantype; + +case @modexpr.kind of + 0 = @modcommentblock +| 1 = @modline +| 2 = @modlineblock +| 3 = @modlparen +| 4 = @modrparen; + +case @error.kind of + 0 = @unknownerror +| 1 = @listerror +| 2 = @parseerror +| 3 = @typeerror; + diff --git a/go/downgrades/20cbf29a08034a40b49ab41c26f37a710de32857/old.dbscheme b/go/downgrades/20cbf29a08034a40b49ab41c26f37a710de32857/old.dbscheme new file mode 100644 index 000000000000..20cbf29a0803 --- /dev/null +++ b/go/downgrades/20cbf29a08034a40b49ab41c26f37a710de32857/old.dbscheme @@ -0,0 +1,555 @@ +/** Auto-generated dbscheme; do not edit. Run `make gen` in directory `go/` to regenerate. */ + + +/** Duplicate code **/ + +duplicateCode( + unique int id : @duplication, + varchar(900) relativePath : string ref, + int equivClass : int ref); + +similarCode( + unique int id : @similarity, + varchar(900) relativePath : string ref, + int equivClass : int ref); + +@duplication_or_similarity = @duplication | @similarity; + +tokens( + int id : @duplication_or_similarity ref, + int offset : int ref, + int beginLine : int ref, + int beginColumn : int ref, + int endLine : int ref, + int endColumn : int ref); + +/** External data **/ + +externalData( + int id : @externalDataElement, + varchar(900) path : string ref, + int column: int ref, + varchar(900) value : string ref +); + +snapshotDate(unique date snapshotDate : date ref); + +sourceLocationPrefix(varchar(900) prefix : string ref); + + +/* + * XML Files + */ + +xmlEncoding( + unique int id: @file ref, + string encoding: string ref +); + +xmlDTDs( + unique int id: @xmldtd, + string root: string ref, + string publicId: string ref, + string systemId: string ref, + int fileid: @file ref +); + +xmlElements( + unique int id: @xmlelement, + string name: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int fileid: @file ref +); + +xmlAttrs( + unique int id: @xmlattribute, + int elementid: @xmlelement ref, + string name: string ref, + string value: string ref, + int idx: int ref, + int fileid: @file ref +); + +xmlNs( + int id: @xmlnamespace, + string prefixName: string ref, + string URI: string ref, + int fileid: @file ref +); + +xmlHasNs( + int elementId: @xmlnamespaceable ref, + int nsId: @xmlnamespace ref, + int fileid: @file ref +); + +xmlComments( + unique int id: @xmlcomment, + string text: string ref, + int parentid: @xmlparent ref, + int fileid: @file ref +); + +xmlChars( + unique int id: @xmlcharacters, + string text: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int isCDATA: int ref, + int fileid: @file ref +); + +@xmlparent = @file | @xmlelement; +@xmlnamespaceable = @xmlelement | @xmlattribute; + +xmllocations( + int xmlElement: @xmllocatable ref, + int location: @location_default ref +); + +@xmllocatable = @xmlcharacters | @xmlelement | @xmlcomment | @xmlattribute | @xmldtd | @file | @xmlnamespace; + +compilations(unique int id: @compilation, string cwd: string ref); + +#keyset[id, num] +compilation_args(int id: @compilation ref, int num: int ref, string arg: string ref); + +#keyset[id, num, kind] +compilation_time(int id: @compilation ref, int num: int ref, int kind: int ref, float secs: float ref); + +diagnostic_for(unique int diagnostic: @diagnostic ref, int compilation: @compilation ref, int file_number: int ref, int file_number_diagnostic_number: int ref); + +compilation_finished(unique int id: @compilation ref, float cpu_seconds: float ref, float elapsed_seconds: float ref); + +#keyset[id, num] +compilation_compiling_files(int id: @compilation ref, int num: int ref, int file: @file ref); + +diagnostics(unique int id: @diagnostic, int severity: int ref, string error_tag: string ref, string error_message: string ref, + string full_error_message: string ref, int location: @location ref); + +locations_default(unique int id: @location_default, int file: @file ref, int beginLine: int ref, int beginColumn: int ref, + int endLine: int ref, int endColumn: int ref); + +numlines(int element_id: @sourceline ref, int num_lines: int ref, int num_code: int ref, int num_comment: int ref); + +files(unique int id: @file, string name: string ref); + +folders(unique int id: @folder, string name: string ref); + +containerparent(int parent: @container ref, unique int child: @container ref); + +has_location(unique int locatable: @locatable ref, int location: @location ref); + +#keyset[parent, idx] +comment_groups(unique int id: @comment_group, int parent: @file ref, int idx: int ref); + +comments(unique int id: @comment, int kind: int ref, int parent: @comment_group ref, int idx: int ref, string text: string ref); + +doc_comments(unique int node: @documentable ref, int comment: @comment_group ref); + +#keyset[parent, idx] +exprs(unique int id: @expr, int kind: int ref, int parent: @exprparent ref, int idx: int ref); + +literals(unique int expr: @expr ref, string value: string ref, string raw: string ref); + +constvalues(unique int expr: @expr ref, string value: string ref, string exact: string ref); + +fields(unique int id: @field, int parent: @fieldparent ref, int idx: int ref); + +typeparamdecls(unique int id: @typeparamdecl, int parent: @typeparamdeclparent ref, int idx: int ref); + +#keyset[parent, idx] +stmts(unique int id: @stmt, int kind: int ref, int parent: @stmtparent ref, int idx: int ref); + +#keyset[parent, idx] +decls(unique int id: @decl, int kind: int ref, int parent: @declparent ref, int idx: int ref); + +#keyset[parent, idx] +specs(unique int id: @spec, int kind: int ref, int parent: @gendecl ref, int idx: int ref); + +scopes(unique int id: @scope, int kind: int ref); + +scopenesting(unique int inner: @scope ref, int outer: @scope ref); + +scopenodes(unique int node: @scopenode ref, int scope: @localscope ref); + +objects(unique int id: @object, int kind: int ref, string name: string ref); + +objectscopes(unique int object: @object ref, int scope: @scope ref); + +objecttypes(unique int object: @object ref, int tp: @type ref); + +methodreceivers(unique int method: @object ref, int receiver: @object ref); + +fieldstructs(unique int field: @object ref, int struct: @structtype ref); + +methodhosts(int method: @object ref, int host: @namedtype ref); + +defs(int ident: @ident ref, int object: @object ref); + +uses(int ident: @ident ref, int object: @object ref); + +types(unique int id: @type, int kind: int ref); + +type_of(unique int expr: @expr ref, int tp: @type ref); + +typename(unique int tp: @type ref, string name: string ref); + +key_type(unique int map: @maptype ref, int tp: @type ref); + +element_type(unique int container: @containertype ref, int tp: @type ref); + +base_type(unique int ptr: @pointertype ref, int tp: @type ref); + +underlying_type(unique int named: @namedtype ref, int tp: @type ref); + +alias_rhs(unique int alias: @typealias ref, int tp: @type ref); + +#keyset[parent, index] +component_types(int parent: @compositetype ref, int index: int ref, string name: string ref, int tp: @type ref); + +#keyset[parent, index] +struct_tags(int parent: @structtype ref, int index: int ref, string tag: string ref); + +#keyset[interface, index] +interface_private_method_ids(int interface: @interfacetype ref, int index: int ref, string id: string ref); + +array_length(unique int tp: @arraytype ref, string len: string ref); + +type_objects(unique int tp: @type ref, int object: @object ref); + +packages(unique int id: @package, string name: string ref, string path: string ref, int scope: @packagescope ref); + +#keyset[parent, idx] +modexprs(unique int id: @modexpr, int kind: int ref, int parent: @modexprparent ref, int idx: int ref); + +#keyset[parent, idx] +modtokens(string token: string ref, int parent: @modexpr ref, int idx: int ref); + +#keyset[package, idx] +errors(unique int id: @error, int kind: int ref, string msg: string ref, string rawpos: string ref, + string file: string ref, int line: int ref, int col: int ref, int package: @package ref, int idx: int ref); + +has_ellipsis(int id: @callorconversionexpr ref); + +variadic(int id: @signaturetype ref); + +#keyset[parent, idx] +typeparam(unique int tp: @typeparamtype ref, string name: string ref, int bound: @compositetype ref, + int parent: @typeparamparentobject ref, int idx: int ref); + +@container = @file | @folder; + +@locatable = @xmllocatable | @node | @localscope; + +@node = @documentable | @exprparent | @modexprparent | @fieldparent | @stmtparent | @declparent | @typeparamdeclparent + | @scopenode | @comment_group | @comment; + +@documentable = @file | @field | @typeparamdecl | @spec | @gendecl | @funcdecl | @modexpr; + +@exprparent = @funcdef | @file | @expr | @field | @stmt | @decl | @typeparamdecl | @spec; + +@modexprparent = @file | @modexpr; + +@fieldparent = @decl | @structtypeexpr | @functypeexpr | @interfacetypeexpr; + +@stmtparent = @funcdef | @stmt | @decl; + +@declparent = @file | @declstmt; + +@typeparamdeclparent = @funcdecl | @typespec; + +@funcdef = @funclit | @funcdecl; + +@scopenode = @file | @functypeexpr | @blockstmt | @ifstmt | @caseclause | @switchstmt | @commclause | @loopstmt; + +@location = @location_default; + +@sourceline = @locatable; + +case @comment.kind of + 0 = @slashslashcomment +| 1 = @slashstarcomment; + +case @expr.kind of + 0 = @badexpr +| 1 = @ident +| 2 = @ellipsis +| 3 = @intlit +| 4 = @floatlit +| 5 = @imaglit +| 6 = @charlit +| 7 = @stringlit +| 8 = @funclit +| 9 = @compositelit +| 10 = @parenexpr +| 11 = @selectorexpr +| 12 = @indexexpr +| 13 = @genericfunctioninstantiationexpr +| 14 = @generictypeinstantiationexpr +| 15 = @sliceexpr +| 16 = @typeassertexpr +| 17 = @callorconversionexpr +| 18 = @starexpr +| 19 = @keyvalueexpr +| 20 = @arraytypeexpr +| 21 = @structtypeexpr +| 22 = @functypeexpr +| 23 = @interfacetypeexpr +| 24 = @maptypeexpr +| 25 = @typesetliteralexpr +| 26 = @plusexpr +| 27 = @minusexpr +| 28 = @notexpr +| 29 = @complementexpr +| 30 = @derefexpr +| 31 = @addressexpr +| 32 = @arrowexpr +| 33 = @lorexpr +| 34 = @landexpr +| 35 = @eqlexpr +| 36 = @neqexpr +| 37 = @lssexpr +| 38 = @leqexpr +| 39 = @gtrexpr +| 40 = @geqexpr +| 41 = @addexpr +| 42 = @subexpr +| 43 = @orexpr +| 44 = @xorexpr +| 45 = @mulexpr +| 46 = @quoexpr +| 47 = @remexpr +| 48 = @shlexpr +| 49 = @shrexpr +| 50 = @andexpr +| 51 = @andnotexpr +| 52 = @sendchantypeexpr +| 53 = @recvchantypeexpr +| 54 = @sendrcvchantypeexpr; + +@basiclit = @intlit | @floatlit | @imaglit | @charlit | @stringlit; + +@operatorexpr = @logicalexpr | @arithmeticexpr | @bitwiseexpr | @unaryexpr | @binaryexpr; + +@logicalexpr = @logicalunaryexpr | @logicalbinaryexpr; + +@arithmeticexpr = @arithmeticunaryexpr | @arithmeticbinaryexpr; + +@bitwiseexpr = @bitwiseunaryexpr | @bitwisebinaryexpr; + +@unaryexpr = @logicalunaryexpr | @bitwiseunaryexpr | @arithmeticunaryexpr | @derefexpr | @addressexpr | @arrowexpr; + +@logicalunaryexpr = @notexpr; + +@bitwiseunaryexpr = @complementexpr; + +@arithmeticunaryexpr = @plusexpr | @minusexpr; + +@binaryexpr = @logicalbinaryexpr | @bitwisebinaryexpr | @arithmeticbinaryexpr | @comparison; + +@logicalbinaryexpr = @lorexpr | @landexpr; + +@bitwisebinaryexpr = @shiftexpr | @orexpr | @xorexpr | @andexpr | @andnotexpr; + +@arithmeticbinaryexpr = @addexpr | @subexpr | @mulexpr | @quoexpr | @remexpr; + +@shiftexpr = @shlexpr | @shrexpr; + +@comparison = @equalitytest | @relationalcomparison; + +@equalitytest = @eqlexpr | @neqexpr; + +@relationalcomparison = @lssexpr | @leqexpr | @gtrexpr | @geqexpr; + +@chantypeexpr = @sendchantypeexpr | @recvchantypeexpr | @sendrcvchantypeexpr; + +case @stmt.kind of + 0 = @badstmt +| 1 = @declstmt +| 2 = @emptystmt +| 3 = @labeledstmt +| 4 = @exprstmt +| 5 = @sendstmt +| 6 = @incstmt +| 7 = @decstmt +| 8 = @gostmt +| 9 = @deferstmt +| 10 = @returnstmt +| 11 = @breakstmt +| 12 = @continuestmt +| 13 = @gotostmt +| 14 = @fallthroughstmt +| 15 = @blockstmt +| 16 = @ifstmt +| 17 = @caseclause +| 18 = @exprswitchstmt +| 19 = @typeswitchstmt +| 20 = @commclause +| 21 = @selectstmt +| 22 = @forstmt +| 23 = @rangestmt +| 24 = @assignstmt +| 25 = @definestmt +| 26 = @addassignstmt +| 27 = @subassignstmt +| 28 = @mulassignstmt +| 29 = @quoassignstmt +| 30 = @remassignstmt +| 31 = @andassignstmt +| 32 = @orassignstmt +| 33 = @xorassignstmt +| 34 = @shlassignstmt +| 35 = @shrassignstmt +| 36 = @andnotassignstmt; + +@incdecstmt = @incstmt | @decstmt; + +@assignment = @simpleassignstmt | @compoundassignstmt; + +@simpleassignstmt = @assignstmt | @definestmt; + +@compoundassignstmt = @addassignstmt | @subassignstmt | @mulassignstmt | @quoassignstmt | @remassignstmt + | @andassignstmt | @orassignstmt | @xorassignstmt | @shlassignstmt | @shrassignstmt | @andnotassignstmt; + +@branchstmt = @breakstmt | @continuestmt | @gotostmt | @fallthroughstmt; + +@switchstmt = @exprswitchstmt | @typeswitchstmt; + +@loopstmt = @forstmt | @rangestmt; + +case @decl.kind of + 0 = @baddecl +| 1 = @importdecl +| 2 = @constdecl +| 3 = @typedecl +| 4 = @vardecl +| 5 = @funcdecl; + +@gendecl = @importdecl | @constdecl | @typedecl | @vardecl; + +case @spec.kind of + 0 = @importspec +| 1 = @valuespec +| 2 = @typedefspec +| 3 = @aliasspec; + +@typespec = @typedefspec | @aliasspec; + +case @object.kind of + 0 = @pkgobject +| 1 = @decltypeobject +| 2 = @builtintypeobject +| 3 = @declconstobject +| 4 = @builtinconstobject +| 5 = @declvarobject +| 6 = @declfunctionobject +| 7 = @builtinfunctionobject +| 8 = @labelobject; + +@typeparamparentobject = @decltypeobject | @declfunctionobject; + +@declobject = @decltypeobject | @declconstobject | @declvarobject | @declfunctionobject; + +@builtinobject = @builtintypeobject | @builtinconstobject | @builtinfunctionobject; + +@typeobject = @decltypeobject | @builtintypeobject; + +@valueobject = @constobject | @varobject | @functionobject; + +@constobject = @declconstobject | @builtinconstobject; + +@varobject = @declvarobject; + +@functionobject = @declfunctionobject | @builtinfunctionobject; + +case @scope.kind of + 0 = @universescope +| 1 = @packagescope +| 2 = @localscope; + +case @type.kind of + 0 = @invalidtype +| 1 = @boolexprtype +| 2 = @inttype +| 3 = @int8type +| 4 = @int16type +| 5 = @int32type +| 6 = @int64type +| 7 = @uinttype +| 8 = @uint8type +| 9 = @uint16type +| 10 = @uint32type +| 11 = @uint64type +| 12 = @uintptrtype +| 13 = @float32type +| 14 = @float64type +| 15 = @complex64type +| 16 = @complex128type +| 17 = @stringexprtype +| 18 = @unsafepointertype +| 19 = @boolliteraltype +| 20 = @intliteraltype +| 21 = @runeliteraltype +| 22 = @floatliteraltype +| 23 = @complexliteraltype +| 24 = @stringliteraltype +| 25 = @nilliteraltype +| 26 = @typeparamtype +| 27 = @arraytype +| 28 = @slicetype +| 29 = @structtype +| 30 = @pointertype +| 31 = @interfacetype +| 32 = @tupletype +| 33 = @signaturetype +| 34 = @maptype +| 35 = @sendchantype +| 36 = @recvchantype +| 37 = @sendrcvchantype +| 38 = @namedtype +| 39 = @typesetliteraltype +| 40 = @typealias; + +@basictype = @booltype | @numerictype | @stringtype | @literaltype | @invalidtype | @unsafepointertype; + +@booltype = @boolexprtype | @boolliteraltype; + +@numerictype = @integertype | @floattype | @complextype; + +@integertype = @signedintegertype | @unsignedintegertype; + +@signedintegertype = @inttype | @int8type | @int16type | @int32type | @int64type | @intliteraltype | @runeliteraltype; + +@unsignedintegertype = @uinttype | @uint8type | @uint16type | @uint32type | @uint64type | @uintptrtype; + +@floattype = @float32type | @float64type | @floatliteraltype; + +@complextype = @complex64type | @complex128type | @complexliteraltype; + +@stringtype = @stringexprtype | @stringliteraltype; + +@literaltype = @boolliteraltype | @intliteraltype | @runeliteraltype | @floatliteraltype | @complexliteraltype + | @stringliteraltype | @nilliteraltype; + +@compositetype = @typeparamtype | @containertype | @structtype | @pointertype | @interfacetype | @tupletype + | @signaturetype | @namedtype | @typesetliteraltype | @typealias; + +@containertype = @arraytype | @slicetype | @maptype | @chantype; + +@chantype = @sendchantype | @recvchantype | @sendrcvchantype; + +case @modexpr.kind of + 0 = @modcommentblock +| 1 = @modline +| 2 = @modlineblock +| 3 = @modlparen +| 4 = @modrparen; + +case @error.kind of + 0 = @unknownerror +| 1 = @listerror +| 2 = @parseerror +| 3 = @typeerror; + diff --git a/go/downgrades/20cbf29a08034a40b49ab41c26f37a710de32857/upgrade.properties b/go/downgrades/20cbf29a08034a40b49ab41c26f37a710de32857/upgrade.properties new file mode 100644 index 000000000000..25288f3cbb5e --- /dev/null +++ b/go/downgrades/20cbf29a08034a40b49ab41c26f37a710de32857/upgrade.properties @@ -0,0 +1,21 @@ +description: Remove support for type aliases +compatibility: full + +alias_rhs.rel: delete +array_length.rel: run explicit_aliases_downgrade.qlo new_array_length +base_type.rel: run explicit_aliases_downgrade.qlo new_base_type +component_types.rel: run explicit_aliases_downgrade.qlo new_component_types +defs.rel: run explicit_aliases_downgrade.qlo new_defs +element_type.rel: run explicit_aliases_downgrade.qlo new_element_type +fieldstructs.rel: run explicit_aliases_downgrade.qlo new_fieldstructs +key_type.rel: run explicit_aliases_downgrade.qlo new_key_type +objects.rel: run explicit_aliases_downgrade.qlo new_objects +objecttypes.rel: run explicit_aliases_downgrade.qlo new_objecttypes +type_objects.rel: run explicit_aliases_downgrade.qlo new_type_objects +type_of.rel: run explicit_aliases_downgrade.qlo new_type_of +typename.rel: run explicit_aliases_downgrade.qlo new_typename +typeparam.rel: run explicit_aliases_downgrade.qlo new_typeparam +types.rel: run explicit_aliases_downgrade.qlo new_types +underlying_type.rel: run explicit_aliases_downgrade.qlo new_underlying_type +uses.rel: run explicit_aliases_downgrade.qlo new_uses +variadic.rel: run explicit_aliases_downgrade.qlo new_variadic diff --git a/go/extractor/dbscheme/tables.go b/go/extractor/dbscheme/tables.go index aa44c6248424..d7e2705998f6 100644 --- a/go/extractor/dbscheme/tables.go +++ b/go/extractor/dbscheme/tables.go @@ -861,6 +861,9 @@ var NamedType = TypeKind.NewBranch("@namedtype", CompositeType) // TypeSetLiteral is the type of type set literals var TypeSetLiteral = TypeKind.NewBranch("@typesetliteraltype", CompositeType) +// TypeAlias is the type of type aliases +var TypeAlias = TypeKind.NewBranch("@typealias", CompositeType) + // PackageType is the type of packages var PackageType = NewPrimaryKeyType("@package") @@ -1142,6 +1145,12 @@ var UnderlyingTypeTable = NewTable("underlying_type", EntityColumn(TypeType, "tp"), ) +// AliasRhsTable is the table associating type aliases with their RHS. +var AliasRhsTable = NewTable("alias_rhs", + EntityColumn(TypeAlias, "alias").Unique(), + EntityColumn(TypeType, "tp"), +) + // ComponentTypesTable is the table associating composite types with their component types var ComponentTypesTable = NewTable("component_types", EntityColumn(CompositeType, "parent"), diff --git a/go/extractor/extractor.go b/go/extractor/extractor.go index c0eef233ba58..bc1ff6322e33 100644 --- a/go/extractor/extractor.go +++ b/go/extractor/extractor.go @@ -1587,9 +1587,101 @@ func resolveTypeAlias(tp types.Type) types.Type { // extractType extracts type information for `tp` and returns its associated label; // types are only extracted once, so the second time `extractType` is invoked it simply returns the label func extractType(tw *trap.Writer, tp types.Type) trap.Label { - tp = resolveTypeAlias(tp) - lbl, exists := getTypeLabel(tw, tp) + return extractTypeWithFlags(tw, tp, false) +} + +func containsAliasTypes(tp types.Type) bool { + switch tp := tp.(type) { + case *types.Basic: + return false + case *types.Array: + return containsAliasTypes(tp.Elem()) + case *types.Slice: + return containsAliasTypes(tp.Elem()) + case *types.Struct: + for i := 0; i < tp.NumFields(); i++ { + field := tp.Field(i) + if containsAliasTypes(field.Type()) { + return true + } + } + return false + case *types.Pointer: + return containsAliasTypes(tp.Elem()) + case *types.Interface: + for i := 0; i < tp.NumMethods(); i++ { + meth := tp.Method(i) + if containsAliasTypes(meth.Type()) { + return true + } + } + for i := 0; i < tp.NumEmbeddeds(); i++ { + if containsAliasTypes(tp.EmbeddedType(i)) { + return true + } + } + return false + case *types.Tuple: + for i := 0; i < tp.Len(); i++ { + if containsAliasTypes(tp.At(i).Type()) { + return true + } + } + return false + case *types.Signature: + params, results := tp.Params(), tp.Results() + if params != nil { + for i := 0; i < params.Len(); i++ { + param := params.At(i) + if containsAliasTypes(param.Type()) { + return true + } + } + } + if results != nil { + for i := 0; i < results.Len(); i++ { + result := results.At(i) + if containsAliasTypes(result.Type()) { + return true + } + } + } + return false + case *types.Map: + return containsAliasTypes(tp.Key()) || containsAliasTypes(tp.Elem()) + case *types.Chan: + return containsAliasTypes(tp.Elem()) + case *types.Named: + return false + case *types.TypeParam: + return false + case *types.Union: + for i := 0; i < tp.Len(); i++ { + term := tp.Term(i) + if containsAliasTypes(term.Type()) { + return true + } + } + return false + case *types.Alias: + return true + default: + log.Fatalf("unexpected type %T", tp) + } + return false +} + +func extractTypeWithFlags(tw *trap.Writer, tp types.Type, transparentAliases bool) trap.Label { + lbl, exists := getTypeLabelWithFlags(tw, tp, transparentAliases) if !exists { + if !transparentAliases && containsAliasTypes(tp) { + // Ensure the (deep) underlying type is also extracted, so that it is + // possible to implement deepUnalias in QL. + // For example, if we had type A = int and type B = string, when extracting + // map[B]A we would need to also extract map[string]int so that + // deepUnalias(map[B]A) has a real member of @type to return. + extractTypeWithFlags(tw, tp, true) + } var kind int switch tp := tp.(type) { case *types.Basic: @@ -1601,10 +1693,10 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label { case *types.Array: kind = dbscheme.ArrayType.Index() dbscheme.ArrayLengthTable.Emit(tw, lbl, fmt.Sprintf("%d", tp.Len())) - extractElementType(tw, lbl, tp.Elem()) + extractElementType(tw, lbl, tp.Elem(), transparentAliases) case *types.Slice: kind = dbscheme.SliceType.Index() - extractElementType(tw, lbl, tp.Elem()) + extractElementType(tw, lbl, tp.Elem(), transparentAliases) case *types.Struct: kind = dbscheme.StructType.Index() for i := 0; i < tp.NumFields(); i++ { @@ -1612,8 +1704,21 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label { // ensure the field is associated with a label - note that // struct fields do not have a parent scope, so they are not - // dealt with by `extractScopes` - fieldlbl, exists := tw.Labeler.FieldID(field, i, lbl) + // dealt with by `extractScopes`. + + // For the transparentAliases case we bypass the object-label cache + // because we're extracting a field relative to a synthetic field + // that has a different type and therefore label, whereas the label + // cache is indexed by object, not type-label. + var fieldlbl trap.Label + var exists bool + if transparentAliases { + fieldlbl = tw.Labeler.FieldIDNoCache(field, i, lbl) + exists = false + } else { + fieldlbl, exists = tw.Labeler.FieldID(field, i, lbl) + } + if !exists { extractObject(tw, field, fieldlbl) } @@ -1624,14 +1729,14 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label { if field.Embedded() { name = "" } - extractComponentType(tw, lbl, i, name, field.Type()) + extractComponentType(tw, lbl, i, name, field.Type(), transparentAliases) if tp.Tag(i) != "" { dbscheme.StructTagsTable.Emit(tw, lbl, i, tp.Tag(i)) } } case *types.Pointer: kind = dbscheme.PointerType.Index() - extractBaseType(tw, lbl, tp.Elem()) + extractBaseType(tw, lbl, tp.Elem(), transparentAliases) case *types.Interface: kind = dbscheme.InterfaceType.Index() for i := 0; i < tp.NumMethods(); i++ { @@ -1640,11 +1745,16 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label { // deal with them separately. meth := tp.Method(i).Origin() - // Note that methods do not have a parent scope, so they are - // not dealt with by `extractScopes` - extractMethod(tw, meth) + if !transparentAliases { + // Note that methods do not have a parent scope, so they are + // not dealt with by `extractScopes` + + // Skip this when extracting a type with transparent aliases; + // this is not the definitive version of the type. + extractMethod(tw, meth) + } - extractComponentType(tw, lbl, i, meth.Name(), meth.Type()) + extractComponentType(tw, lbl, i, meth.Name(), meth.Type(), transparentAliases) if !meth.Exported() { dbscheme.InterfacePrivateMethodIdsTable.Emit(tw, lbl, i, meth.Id()) @@ -1655,12 +1765,12 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label { if isNonUnionTypeSetLiteral(component) { component = createUnionFromType(component) } - extractComponentType(tw, lbl, -(i + 1), "", component) + extractComponentType(tw, lbl, -(i + 1), "", component, transparentAliases) } case *types.Tuple: kind = dbscheme.TupleType.Index() for i := 0; i < tp.Len(); i++ { - extractComponentType(tw, lbl, i, "", tp.At(i).Type()) + extractComponentType(tw, lbl, i, "", tp.At(i).Type(), transparentAliases) } case *types.Signature: kind = dbscheme.SignatureType.Index() @@ -1668,13 +1778,13 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label { if params != nil { for i := 0; i < params.Len(); i++ { param := params.At(i) - extractComponentType(tw, lbl, i+1, "", param.Type()) + extractComponentType(tw, lbl, i+1, "", param.Type(), transparentAliases) } } if results != nil { for i := 0; i < results.Len(); i++ { result := results.At(i) - extractComponentType(tw, lbl, -(i + 1), "", result.Type()) + extractComponentType(tw, lbl, -(i + 1), "", result.Type(), transparentAliases) } } if tp.Variadic() { @@ -1682,54 +1792,53 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label { } case *types.Map: kind = dbscheme.MapType.Index() - extractKeyType(tw, lbl, tp.Key()) - extractElementType(tw, lbl, tp.Elem()) + extractKeyType(tw, lbl, tp.Key(), transparentAliases) + extractElementType(tw, lbl, tp.Elem(), transparentAliases) case *types.Chan: kind = dbscheme.ChanTypes[tp.Dir()].Index() - extractElementType(tw, lbl, tp.Elem()) + extractElementType(tw, lbl, tp.Elem(), transparentAliases) case *types.Named: origintp := tp.Origin() kind = dbscheme.NamedType.Index() dbscheme.TypeNameTable.Emit(tw, lbl, origintp.Obj().Name()) underlying := origintp.Underlying() extractUnderlyingType(tw, lbl, underlying) - trackInstantiatedStructFields(tw, tp, origintp) - entitylbl, exists := tw.Labeler.LookupObjectID(origintp.Obj(), lbl) - if entitylbl == trap.InvalidLabel { - log.Printf("Omitting type-object binding for unknown object %v.\n", origintp.Obj()) - } else { - if !exists { - extractObject(tw, origintp.Obj(), entitylbl) - } - dbscheme.TypeObjectTable.Emit(tw, lbl, entitylbl) - } + if !transparentAliases { + // The transparent and non-transparent versions of a named typed + // should be equal, so this is probably harmless, but regardless + // don't repeat it to save time. - // ensure all methods have labels - note that methods do not have a - // parent scope, so they are not dealt with by `extractScopes` - for i := 0; i < origintp.NumMethods(); i++ { - meth := origintp.Method(i).Origin() + trackInstantiatedStructFields(tw, tp, origintp) - extractMethod(tw, meth) - } + extractTypeObject(tw, lbl, origintp.Obj()) - underlyingInterface, underlyingIsInterface := underlying.(*types.Interface) - _, underlyingIsPointer := underlying.(*types.Pointer) + // ensure all methods have labels - note that methods do not have a + // parent scope, so they are not dealt with by `extractScopes` + for i := 0; i < origintp.NumMethods(); i++ { + meth := origintp.Method(i).Origin() - // associate all methods of underlying interface with this type - if underlyingIsInterface { - for i := 0; i < underlyingInterface.NumMethods(); i++ { - methlbl := extractMethod(tw, underlyingInterface.Method(i).Origin()) - dbscheme.MethodHostsTable.Emit(tw, methlbl, lbl) + extractMethod(tw, meth) + } + + underlyingInterface, underlyingIsInterface := underlying.(*types.Interface) + _, underlyingIsPointer := underlying.(*types.Pointer) + + // associate all methods of underlying interface with this type + if underlyingIsInterface { + for i := 0; i < underlyingInterface.NumMethods(); i++ { + methlbl := extractMethod(tw, underlyingInterface.Method(i).Origin()) + dbscheme.MethodHostsTable.Emit(tw, methlbl, lbl) + } } - } - // If `underlying` is not a pointer or interface then methods can - // be defined on `origintp`. In this case we must ensure that - // `*origintp` is in the database, so that Method.hasQualifiedName - // correctly includes methods with receiver type `*origintp`. - if !underlyingIsInterface && !underlyingIsPointer { - extractType(tw, types.NewPointer(origintp)) + // If `underlying` is not a pointer or interface then methods can + // be defined on `origintp`. In this case we must ensure that + // `*origintp` is in the database, so that Method.hasQualifiedName + // correctly includes methods with receiver type `*origintp`. + if !underlyingIsInterface && !underlyingIsPointer { + extractType(tw, types.NewPointer(origintp)) + } } case *types.TypeParam: kind = dbscheme.TypeParamType.Index() @@ -1744,7 +1853,19 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label { if term.Tilde() { tildeStr = "~" } - extractComponentType(tw, lbl, i, tildeStr, term.Type()) + extractComponentType(tw, lbl, i, tildeStr, term.Type(), transparentAliases) + } + case *types.Alias: + if transparentAliases { + // Nothing to do; getTypeLabel will already have looked + // through the alias, extracted and returned its RHS. + return lbl + } else { + kind = dbscheme.TypeAlias.Index() + dbscheme.TypeNameTable.Emit(tw, lbl, tp.Obj().Name()) + dbscheme.AliasRhsTable.Emit(tw, lbl, extractType(tw, tp.Rhs())) + + extractTypeObject(tw, lbl, tp.Obj()) } default: log.Fatalf("unexpected type %T", tp) @@ -1765,24 +1886,33 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label { // is constructed from their globally unique ID. This prevents cyclic type keys // since type recursion in Go always goes through named types. func getTypeLabel(tw *trap.Writer, tp types.Type) (trap.Label, bool) { - tp = resolveTypeAlias(tp) - lbl, exists := tw.Labeler.TypeLabels[tp] + return getTypeLabelWithFlags(tw, tp, false) +} + +func getTypeLabelWithFlags(tw *trap.Writer, tp types.Type, transparentAliases bool) (trap.Label, bool) { + typeLabelKey := trap.TypeLabelsKey{Type: tp, TransparentAliases: transparentAliases} + lbl, exists := tw.Labeler.TypeLabels[typeLabelKey] if !exists { + if transparentAliases && !containsAliasTypes(tp) { + // No aliases involved, so the label is the same as the non-transparent version + // of the same type. + return getTypeLabelWithFlags(tw, tp, false) + } switch tp := tp.(type) { case *types.Basic: lbl = tw.Labeler.GlobalID(fmt.Sprintf("%d;basictype", tp.Kind())) case *types.Array: len := tp.Len() - elem := extractType(tw, tp.Elem()) + elem := extractTypeWithFlags(tw, tp.Elem(), transparentAliases) lbl = tw.Labeler.GlobalID(fmt.Sprintf("%d,{%s};arraytype", len, elem)) case *types.Slice: - elem := extractType(tw, tp.Elem()) + elem := extractTypeWithFlags(tw, tp.Elem(), transparentAliases) lbl = tw.Labeler.GlobalID(fmt.Sprintf("{%s};slicetype", elem)) case *types.Struct: var b strings.Builder for i := 0; i < tp.NumFields(); i++ { field := tp.Field(i) - fieldTypeLbl := extractType(tw, field.Type()) + fieldTypeLbl := extractTypeWithFlags(tw, field.Type(), transparentAliases) if i > 0 { b.WriteString(",") } @@ -1794,13 +1924,13 @@ func getTypeLabel(tw *trap.Writer, tp types.Type) (trap.Label, bool) { } lbl = tw.Labeler.GlobalID(fmt.Sprintf("%s;structtype", b.String())) case *types.Pointer: - base := extractType(tw, tp.Elem()) + base := extractTypeWithFlags(tw, tp.Elem(), transparentAliases) lbl = tw.Labeler.GlobalID(fmt.Sprintf("{%s};pointertype", base)) case *types.Interface: var b strings.Builder for i := 0; i < tp.NumMethods(); i++ { meth := tp.Method(i).Origin() - methLbl := extractType(tw, meth.Type()) + methLbl := extractTypeWithFlags(tw, meth.Type(), transparentAliases) if i > 0 { b.WriteString(",") } @@ -1811,7 +1941,7 @@ func getTypeLabel(tw *trap.Writer, tp types.Type) (trap.Label, bool) { if i > 0 { b.WriteString(",") } - fmt.Fprintf(&b, "{%s}", extractType(tw, tp.EmbeddedType(i))) + fmt.Fprintf(&b, "{%s}", extractTypeWithFlags(tw, tp.EmbeddedType(i), transparentAliases)) } // We note whether the interface is comparable so that we can // distinguish the underlying type of `comparable` from an @@ -1823,7 +1953,7 @@ func getTypeLabel(tw *trap.Writer, tp types.Type) (trap.Label, bool) { case *types.Tuple: var b strings.Builder for i := 0; i < tp.Len(); i++ { - compLbl := extractType(tw, tp.At(i).Type()) + compLbl := extractTypeWithFlags(tw, tp.At(i).Type(), transparentAliases) if i > 0 { b.WriteString(",") } @@ -1835,7 +1965,7 @@ func getTypeLabel(tw *trap.Writer, tp types.Type) (trap.Label, bool) { params, results := tp.Params(), tp.Results() if params != nil { for i := 0; i < params.Len(); i++ { - paramLbl := extractType(tw, params.At(i).Type()) + paramLbl := extractTypeWithFlags(tw, params.At(i).Type(), transparentAliases) if i > 0 { b.WriteString(",") } @@ -1845,7 +1975,7 @@ func getTypeLabel(tw *trap.Writer, tp types.Type) (trap.Label, bool) { b.WriteString(";") if results != nil { for i := 0; i < results.Len(); i++ { - resultLbl := extractType(tw, results.At(i).Type()) + resultLbl := extractTypeWithFlags(tw, results.At(i).Type(), transparentAliases) if i > 0 { b.WriteString(",") } @@ -1857,12 +1987,12 @@ func getTypeLabel(tw *trap.Writer, tp types.Type) (trap.Label, bool) { } lbl = tw.Labeler.GlobalID(fmt.Sprintf("%s;signaturetype", b.String())) case *types.Map: - key := extractType(tw, tp.Key()) - value := extractType(tw, tp.Elem()) + key := extractTypeWithFlags(tw, tp.Key(), transparentAliases) + value := extractTypeWithFlags(tw, tp.Elem(), transparentAliases) lbl = tw.Labeler.GlobalID(fmt.Sprintf("{%s},{%s};maptype", key, value)) case *types.Chan: dir := tp.Dir() - elem := extractType(tw, tp.Elem()) + elem := extractTypeWithFlags(tw, tp.Elem(), transparentAliases) lbl = tw.Labeler.GlobalID(fmt.Sprintf("%v,{%s};chantype", dir, elem)) case *types.Named: origintp := tp.Origin() @@ -1881,7 +2011,7 @@ func getTypeLabel(tw *trap.Writer, tp types.Type) (trap.Label, bool) { case *types.Union: var b strings.Builder for i := 0; i < tp.Len(); i++ { - compLbl := extractType(tw, tp.Term(i).Type()) + compLbl := extractTypeWithFlags(tw, tp.Term(i).Type(), transparentAliases) if i > 0 { b.WriteString("|") } @@ -1891,27 +2021,57 @@ func getTypeLabel(tw *trap.Writer, tp types.Type) (trap.Label, bool) { fmt.Fprintf(&b, "{%s}", compLbl) } lbl = tw.Labeler.GlobalID(fmt.Sprintf("%s;typesetliteraltype", b.String())) + case *types.Alias: + if transparentAliases { + lbl = extractTypeWithFlags(tw, tp.Rhs(), true) + } else { + // Ensure that the definition of the aliased type gets extracted + // (which may be an alias in itself). + extractType(tw, tp.Rhs()) + + entitylbl, exists := tw.Labeler.LookupObjectID(tp.Obj(), lbl) + if entitylbl == trap.InvalidLabel { + panic(fmt.Sprintf("Cannot construct label for alias type %v (underlying object is %v).\n", tp, tp.Obj())) + } + if !exists { + extractObject(tw, tp.Obj(), entitylbl) + } + lbl = tw.Labeler.GlobalID(fmt.Sprintf("{%s};aliastype", entitylbl)) + } default: log.Fatalf("(getTypeLabel) unexpected type %T", tp) } - tw.Labeler.TypeLabels[tp] = lbl + tw.Labeler.TypeLabels[typeLabelKey] = lbl } return lbl, exists } +// extractTypeObject extracts a single type object and emits it to the type object table. +func extractTypeObject(tw *trap.Writer, lbl trap.Label, entity *types.TypeName) { + entitylbl, exists := tw.Labeler.LookupObjectID(entity, lbl) + if entitylbl == trap.InvalidLabel { + log.Printf("Omitting type-object binding for unknown object %v.\n", entity) + } else { + if !exists { + extractObject(tw, entity, entitylbl) + } + dbscheme.TypeObjectTable.Emit(tw, lbl, entitylbl) + } +} + // extractKeyType extracts `key` as the key type of the map type `mp` -func extractKeyType(tw *trap.Writer, mp trap.Label, key types.Type) { - dbscheme.KeyTypeTable.Emit(tw, mp, extractType(tw, key)) +func extractKeyType(tw *trap.Writer, mp trap.Label, key types.Type, transparentAliases bool) { + dbscheme.KeyTypeTable.Emit(tw, mp, extractTypeWithFlags(tw, key, transparentAliases)) } // extractElementType extracts `element` as the element type of the container type `container` -func extractElementType(tw *trap.Writer, container trap.Label, element types.Type) { - dbscheme.ElementTypeTable.Emit(tw, container, extractType(tw, element)) +func extractElementType(tw *trap.Writer, container trap.Label, element types.Type, transparentAliases bool) { + dbscheme.ElementTypeTable.Emit(tw, container, extractTypeWithFlags(tw, element, transparentAliases)) } // extractBaseType extracts `base` as the base type of the pointer type `ptr` -func extractBaseType(tw *trap.Writer, ptr trap.Label, base types.Type) { - dbscheme.BaseTypeTable.Emit(tw, ptr, extractType(tw, base)) +func extractBaseType(tw *trap.Writer, ptr trap.Label, base types.Type, transparentAliases bool) { + dbscheme.BaseTypeTable.Emit(tw, ptr, extractTypeWithFlags(tw, base, transparentAliases)) } // extractUnderlyingType extracts `underlying` as the underlying type of the @@ -1921,8 +2081,8 @@ func extractUnderlyingType(tw *trap.Writer, named trap.Label, underlying types.T } // extractComponentType extracts `component` as the `idx`th component type of `parent` with name `name` -func extractComponentType(tw *trap.Writer, parent trap.Label, idx int, name string, component types.Type) { - dbscheme.ComponentTypesTable.Emit(tw, parent, idx, name, extractType(tw, component)) +func extractComponentType(tw *trap.Writer, parent trap.Label, idx int, name string, component types.Type, transparentAliases bool) { + dbscheme.ComponentTypesTable.Emit(tw, parent, idx, name, extractTypeWithFlags(tw, component, transparentAliases)) } // extractNumLines extracts lines-of-code and lines-of-comments information for the diff --git a/go/extractor/trap/labels.go b/go/extractor/trap/labels.go index 6052149c183d..c843fac5c478 100644 --- a/go/extractor/trap/labels.go +++ b/go/extractor/trap/labels.go @@ -19,6 +19,11 @@ func (lbl *Label) String() string { return lbl.id } +type TypeLabelsKey struct { + Type types.Type + TransparentAliases bool +} + // Labeler is used to represent labels for a file. It is used to write // associate objects with labels. type Labeler struct { @@ -26,10 +31,10 @@ type Labeler struct { nextid int fileLabel Label - nodeLabels map[interface{}]Label // labels associated with AST nodes - scopeLabels map[*types.Scope]Label // labels associated with scopes - objectLabels map[types.Object]Label // labels associated with objects (that is, declared entities) - TypeLabels map[types.Type]Label // labels associated with types + nodeLabels map[interface{}]Label // labels associated with AST nodes + scopeLabels map[*types.Scope]Label // labels associated with scopes + objectLabels map[types.Object]Label // labels associated with objects (that is, declared entities) + TypeLabels map[TypeLabelsKey]Label // labels associated with types keyLabels map[string]Label } @@ -41,7 +46,7 @@ func newLabeler(tw *Writer) *Labeler { make(map[interface{}]Label), make(map[*types.Scope]Label), make(map[types.Object]Label), - make(map[types.Type]Label), + make(map[TypeLabelsKey]Label), make(map[string]Label), } } @@ -205,6 +210,16 @@ func (l *Labeler) ReceiverObjectID(object types.Object, methlbl Label) (Label, b return label, exists } +func (l *Labeler) FieldIDNoCache(field *types.Var, idx int, structlbl Label) Label { + name := field.Name() + // there can be multiple fields with the blank identifier, so use index to + // distinguish them + if field.Name() == "_" { + name = fmt.Sprintf("_%d", idx) + } + return l.GlobalID(fmt.Sprintf("{%v},%s;field", structlbl, name)) +} + // FieldID associates a label with the given field and returns it, together with // a flag indicating whether the field already had a label associated with it; // the field must belong to `structlbl`, since that label is used to construct @@ -213,13 +228,7 @@ func (l *Labeler) ReceiverObjectID(object types.Object, methlbl Label) (Label, b func (l *Labeler) FieldID(field *types.Var, idx int, structlbl Label) (Label, bool) { label, exists := l.objectLabels[field] if !exists { - name := field.Name() - // there can be multiple fields with the blank identifier, so use index to - // distinguish them - if field.Name() == "_" { - name = fmt.Sprintf("_%d", idx) - } - label = l.GlobalID(fmt.Sprintf("{%v},%s;field", structlbl, name)) + label = l.FieldIDNoCache(field, idx, structlbl) l.objectLabels[field] = label } return label, exists diff --git a/go/lock b/go/lock new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/go/ql/lib/change-notes/2024-08-22-go-1.23-supported.md b/go/ql/lib/change-notes/2024-08-22-go-1.23-supported.md new file mode 100644 index 000000000000..d1526a0ee1ec --- /dev/null +++ b/go/ql/lib/change-notes/2024-08-22-go-1.23-supported.md @@ -0,0 +1,4 @@ +--- +category: majorAnalysis +--- +* Go 1.23 has been included in the range of supported Go versions. diff --git a/go/ql/lib/go.dbscheme b/go/ql/lib/go.dbscheme index 4bd57e093275..20cbf29a0803 100644 --- a/go/ql/lib/go.dbscheme +++ b/go/ql/lib/go.dbscheme @@ -204,6 +204,8 @@ base_type(unique int ptr: @pointertype ref, int tp: @type ref); underlying_type(unique int named: @namedtype ref, int tp: @type ref); +alias_rhs(unique int alias: @typealias ref, int tp: @type ref); + #keyset[parent, index] component_types(int parent: @compositetype ref, int index: int ref, string name: string ref, int tp: @type ref); @@ -507,7 +509,8 @@ case @type.kind of | 36 = @recvchantype | 37 = @sendrcvchantype | 38 = @namedtype -| 39 = @typesetliteraltype; +| 39 = @typesetliteraltype +| 40 = @typealias; @basictype = @booltype | @numerictype | @stringtype | @literaltype | @invalidtype | @unsafepointertype; @@ -531,7 +534,7 @@ case @type.kind of | @stringliteraltype | @nilliteraltype; @compositetype = @typeparamtype | @containertype | @structtype | @pointertype | @interfacetype | @tupletype - | @signaturetype | @namedtype | @typesetliteraltype; + | @signaturetype | @namedtype | @typesetliteraltype | @typealias; @containertype = @arraytype | @slicetype | @maptype | @chantype; diff --git a/go/ql/lib/semmle/go/Types.qll b/go/ql/lib/semmle/go/Types.qll index 1f1234aa1ded..b878a8e32381 100644 --- a/go/ql/lib/semmle/go/Types.qll +++ b/go/ql/lib/semmle/go/Types.qll @@ -53,7 +53,7 @@ class Type extends @type { * with the corresponding named type instead. */ Method getMethod(string m) { - result.getReceiverType() = this and + result.getReceiverType().getDeepUnaliasedType() = this.getDeepUnaliasedType() and result.getName() = m } @@ -90,7 +90,9 @@ class Type extends @type { hasNoMethods(i) or this.hasMethod(getExampleMethodName(i), _) and - forall(string m, SignatureType t | i.hasMethod(m, t) | this.hasMethod(m, t)) + forall(string m, SignatureType t | interfaceHasMethodWithDeepUnaliasedType(i, m, t) | + hasMethodWithDeepUnaliasedType(this, m, t) + ) ) ) } @@ -134,6 +136,13 @@ class Type extends @type { */ PointerType getPointerType() { result.getBaseType() = this } + /** + * Gets this type with all aliases substituted for their underlying type. + * + * Note named types are not substituted. + */ + Type getDeepUnaliasedType() { result = this } + /** * Gets a pretty-printed representation of this type, including its structure where applicable. */ @@ -165,6 +174,21 @@ class Type extends @type { } } +pragma[nomagic] +private predicate hasMethodWithDeepUnaliasedType(Type t, string name, SignatureType unaliasedType) { + exists(SignatureType methodType | + t.hasMethod(name, methodType) and + methodType.getDeepUnaliasedType() = unaliasedType + ) +} + +pragma[nomagic] +private predicate interfaceHasMethodWithDeepUnaliasedType( + InterfaceType i, string name, SignatureType unaliasedType +) { + exists(SignatureType t | i.hasMethod(name, t) and t.getDeepUnaliasedType() = unaliasedType) +} + /** An invalid type. */ class InvalidType extends @invalidtype, Type { override string toString() { result = "invalid type" } @@ -411,6 +435,11 @@ class ArrayType extends @arraytype, CompositeType { override Package getPackage() { result = this.getElementType().getPackage() } + override ArrayType getDeepUnaliasedType() { + result.getElementType() = this.getElementType().getDeepUnaliasedType() and + result.getLengthString() = this.getLengthString() + } + override string pp() { result = "[" + this.getLength() + "]" + this.getElementType().pp() } override string toString() { result = "array type" } @@ -423,6 +452,10 @@ class SliceType extends @slicetype, CompositeType { override Package getPackage() { result = this.getElementType().getPackage() } + override SliceType getDeepUnaliasedType() { + result.getElementType() = this.getElementType().getDeepUnaliasedType() + } + override string pp() { result = "[]" + this.getElementType().pp() } override string toString() { result = "slice type" } @@ -433,6 +466,102 @@ class ByteSliceType extends SliceType { ByteSliceType() { this.getElementType() instanceof Uint8Type } } +// Improve efficiency of matching a struct to its unaliased equivalent +// by unpacking the first 5 fields and tags, allowing a single join +// to strongly constrain the available candidates. +private predicate hasComponentTypeAndTag(StructType s, int i, string name, Type tp, string tag) { + component_types(s, i, name, tp) and tag = getStructTag(s, i) +} + +private newtype TOptStructComponent = + MkNoComponent() or + MkSomeComponent(string name, Type tp, string tag) { hasComponentTypeAndTag(_, _, name, tp, tag) } + +private class OptStructComponent extends TOptStructComponent { + OptStructComponent getWithDeepUnaliasedType() { + this = MkNoComponent() and result = MkNoComponent() + or + exists(string name, Type tp, string tag | + this = MkSomeComponent(name, tp, tag) and + result = MkSomeComponent(name, tp.getDeepUnaliasedType(), tag) + ) + } + + string toString() { result = "struct component" } +} + +private class StructComponent extends MkSomeComponent { + string toString() { result = "struct component" } + + predicate isComponentOf(StructType s, int i) { + exists(string name, Type tp, string tag | + hasComponentTypeAndTag(s, i, name, tp, tag) and + this = MkSomeComponent(name, tp, tag) + ) + } +} + +/** + */ +pragma[nomagic] +private predicate unpackStructType( + StructType s, TOptStructComponent c0, TOptStructComponent c1, TOptStructComponent c2, + TOptStructComponent c3, TOptStructComponent c4, int nComponents +) { + nComponents = count(int i | component_types(s, i, _, _)) and + ( + if nComponents >= 1 + then c0 = any(StructComponent sc | sc.isComponentOf(s, 0)) + else c0 = MkNoComponent() + ) and + ( + if nComponents >= 2 + then c1 = any(StructComponent sc | sc.isComponentOf(s, 1)) + else c1 = MkNoComponent() + ) and + ( + if nComponents >= 3 + then c2 = any(StructComponent sc | sc.isComponentOf(s, 2)) + else c2 = MkNoComponent() + ) and + ( + if nComponents >= 4 + then c3 = any(StructComponent sc | sc.isComponentOf(s, 3)) + else c3 = MkNoComponent() + ) and + ( + if nComponents >= 5 + then c4 = any(StructComponent sc | sc.isComponentOf(s, 4)) + else c4 = MkNoComponent() + ) +} + +pragma[nomagic] +private predicate unpackAndUnaliasStructType( + StructType s, TOptStructComponent c0, TOptStructComponent c1, TOptStructComponent c2, + TOptStructComponent c3, TOptStructComponent c4, int nComponents +) { + exists( + OptStructComponent c0a, OptStructComponent c1a, OptStructComponent c2a, OptStructComponent c3a, + OptStructComponent c4a + | + unpackStructType(s, c0a, c1a, c2a, c3a, c4a, nComponents) and + c0 = c0a.getWithDeepUnaliasedType() and + c1 = c1a.getWithDeepUnaliasedType() and + c2 = c2a.getWithDeepUnaliasedType() and + c3 = c3a.getWithDeepUnaliasedType() and + c4 = c4a.getWithDeepUnaliasedType() + ) +} + +bindingset[i] +pragma[inline] +private string getStructTag(StructType st, int i) { + struct_tags(st, i, result) + or + not struct_tags(st, i, _) and result = "" +} + /** A struct type. */ class StructType extends @structtype, CompositeType { /** @@ -446,7 +575,7 @@ class StructType extends @structtype, CompositeType { if n = "" then ( isEmbedded = true and - name = lookThroughPointerType(tp).(NamedType).getName() + name = lookThroughPointerType(unalias(tp)).(NamedType).getName() ) else ( isEmbedded = false and name = n @@ -461,12 +590,7 @@ class StructType extends @structtype, CompositeType { * Note that this predicate does not take promoted fields into account. */ predicate hasOwnFieldWithTag(int i, string name, Type tp, boolean isEmbedded, string tag) { - this.hasOwnField(i, name, tp, isEmbedded) and - ( - struct_tags(this, i, tag) - or - not struct_tags(this, i, _) and tag = "" - ) + this.hasOwnField(i, name, tp, isEmbedded) and tag = getStructTag(this, i) } /** @@ -578,6 +702,39 @@ class StructType extends @structtype, CompositeType { ) } + private StructType getDeepUnaliasedTypeCandidate() { + exists( + OptStructComponent c0, OptStructComponent c1, OptStructComponent c2, OptStructComponent c3, + OptStructComponent c4, int nComponents + | + unpackAndUnaliasStructType(this, c0, c1, c2, c3, c4, nComponents) and + unpackStructType(result, c0, c1, c2, c3, c4, nComponents) + ) + } + + private predicate isDeepUnaliasedTypeUpTo(StructType unaliased, int i) { + // Note we must use component_types not hasOwnField here because component_types may specify + // interface-in-struct embedding, but hasOwnField does not return such members. + unaliased = this.getDeepUnaliasedTypeCandidate() and + i >= 5 and + ( + i = 5 or + this.isDeepUnaliasedTypeUpTo(unaliased, i - 1) + ) and + exists(string name, Type tp, string tag | hasComponentTypeAndTag(this, i, name, tp, tag) | + hasComponentTypeAndTag(unaliased, i, name, tp.getDeepUnaliasedType(), tag) + ) + } + + override StructType getDeepUnaliasedType() { + result = this.getDeepUnaliasedTypeCandidate() and + exists(int nComponents | nComponents = count(int i | component_types(this, i, _, _)) | + this.isDeepUnaliasedTypeUpTo(result, nComponents - 1) + or + nComponents <= 5 + ) + } + language[monotonicAggregates] override string pp() { result = @@ -630,6 +787,10 @@ class PointerType extends @pointertype, CompositeType { ) } + override PointerType getDeepUnaliasedType() { + result.getBaseType() = this.getBaseType().getDeepUnaliasedType() + } + override string pp() { result = "* " + this.getBaseType().pp() } override string toString() { result = "pointer type" } @@ -759,6 +920,116 @@ class TypeSetLiteralType extends @typesetliteraltype, CompositeType { override string toString() { result = "type set literal type" } } +private predicate isInterfaceComponentWithQualifiedName( + InterfaceType intf, int idx, string qualifiedName, Type tp +) { + exists(string name | component_types(intf, idx, name, tp) | + interface_private_method_ids(intf, idx, qualifiedName) + or + not interface_private_method_ids(intf, idx, _) and qualifiedName = name + ) +} + +private newtype TOptInterfaceComponent = + MkNoIComponent() or + MkSomeIComponent(string name, Type tp) { + isInterfaceComponentWithQualifiedName(any(InterfaceType i), _, name, tp) + } + +private class OptInterfaceComponent extends TOptInterfaceComponent { + OptInterfaceComponent getWithDeepUnaliasedType() { + this = MkNoIComponent() and result = MkNoIComponent() + or + exists(string name, Type tp | + this = MkSomeIComponent(name, tp) and + result = MkSomeIComponent(name, tp.getDeepUnaliasedType()) + ) + } + + string toString() { result = "interface component" } +} + +private class InterfaceComponent extends MkSomeIComponent { + string toString() { result = "interface component" } + + predicate isComponentOf(InterfaceType intf, int i) { + exists(string name, Type tp | + isInterfaceComponentWithQualifiedName(intf, i, name, tp) and + this = MkSomeIComponent(name, tp) + ) + } +} + +pragma[nomagic] +private predicate unpackInterfaceType( + InterfaceType intf, TOptInterfaceComponent c0, TOptInterfaceComponent c1, + TOptInterfaceComponent c2, TOptInterfaceComponent c3, TOptInterfaceComponent c4, + TOptInterfaceComponent e1, TOptInterfaceComponent e2, int nComponents, int nEmbeds, + boolean isComparable +) { + nComponents = count(int i | isInterfaceComponentWithQualifiedName(intf, i, _, _) and i >= 0) and + nEmbeds = count(int i | isInterfaceComponentWithQualifiedName(intf, i, _, _) and i < 0) and + (if intf.isOrEmbedsComparable() then isComparable = true else isComparable = false) and + ( + if nComponents >= 1 + then c0 = any(InterfaceComponent ic | ic.isComponentOf(intf, 0)) + else c0 = MkNoIComponent() + ) and + ( + if nComponents >= 2 + then c1 = any(InterfaceComponent ic | ic.isComponentOf(intf, 1)) + else c1 = MkNoIComponent() + ) and + ( + if nComponents >= 3 + then c2 = any(InterfaceComponent ic | ic.isComponentOf(intf, 2)) + else c2 = MkNoIComponent() + ) and + ( + if nComponents >= 4 + then c3 = any(InterfaceComponent ic | ic.isComponentOf(intf, 3)) + else c3 = MkNoIComponent() + ) and + ( + if nComponents >= 5 + then c4 = any(InterfaceComponent ic | ic.isComponentOf(intf, 4)) + else c4 = MkNoIComponent() + ) and + ( + if nEmbeds >= 1 + then e1 = any(InterfaceComponent ic | ic.isComponentOf(intf, -1)) + else e1 = MkNoIComponent() + ) and + ( + if nEmbeds >= 2 + then e2 = any(InterfaceComponent ic | ic.isComponentOf(intf, -2)) + else e2 = MkNoIComponent() + ) +} + +pragma[nomagic] +private predicate unpackAndUnaliasInterfaceType( + InterfaceType intf, TOptInterfaceComponent c0, TOptInterfaceComponent c1, + TOptInterfaceComponent c2, TOptInterfaceComponent c3, TOptInterfaceComponent c4, + TOptInterfaceComponent e1, TOptInterfaceComponent e2, int nComponents, int nEmbeds, + boolean isComparable +) { + exists( + OptInterfaceComponent c0a, OptInterfaceComponent c1a, OptInterfaceComponent c2a, + OptInterfaceComponent c3a, OptInterfaceComponent c4a, OptInterfaceComponent e1a, + OptInterfaceComponent e2a + | + unpackInterfaceType(intf, c0a, c1a, c2a, c3a, c4a, e1a, e2a, nComponents, nEmbeds, isComparable) and + c0 = c0a.getWithDeepUnaliasedType() and + c1 = c1a.getWithDeepUnaliasedType() and + c2 = c2a.getWithDeepUnaliasedType() and + c3 = c3a.getWithDeepUnaliasedType() and + c4 = c4a.getWithDeepUnaliasedType() and + e1 = e1a.getWithDeepUnaliasedType() and + e2 = e2a.getWithDeepUnaliasedType() + ) +} + /** An interface type. */ class InterfaceType extends @interfacetype, CompositeType { /** Gets the type of method `name` of this interface type. */ @@ -852,6 +1123,61 @@ class InterfaceType extends @interfacetype, CompositeType { .getAnEmbeddedTypeSetLiteral() } + private InterfaceType getDeepUnaliasedTypeCandidate() { + exists( + OptInterfaceComponent c0, OptInterfaceComponent c1, OptInterfaceComponent c2, + OptInterfaceComponent c3, OptInterfaceComponent c4, OptInterfaceComponent e1, + OptInterfaceComponent e2, int nComponents, int nEmbeds, boolean isComparable + | + unpackAndUnaliasInterfaceType(this, c0, c1, c2, c3, c4, e1, e2, nComponents, nEmbeds, + isComparable) and + unpackInterfaceType(result, c0, c1, c2, c3, c4, e1, e2, nComponents, nEmbeds, isComparable) + ) + } + + private predicate hasDeepUnaliasedComponentTypesUpTo(InterfaceType unaliased, int i) { + unaliased = this.getDeepUnaliasedTypeCandidate() and + i >= 5 and + ( + i = 5 or + this.hasDeepUnaliasedComponentTypesUpTo(unaliased, i - 1) + ) and + exists(string name, Type tp | isInterfaceComponentWithQualifiedName(this, i, name, tp) | + isInterfaceComponentWithQualifiedName(unaliased, i, name, tp.getDeepUnaliasedType()) + ) + } + + private predicate hasDeepUnaliasedEmbeddedTypesUpTo(InterfaceType unaliased, int i) { + unaliased = this.getDeepUnaliasedTypeCandidate() and + i >= 3 and + ( + i = 3 or + this.hasDeepUnaliasedEmbeddedTypesUpTo(unaliased, i - 1) + ) and + exists(string name, Type tp | isInterfaceComponentWithQualifiedName(this, -i, name, tp) | + isInterfaceComponentWithQualifiedName(unaliased, -i, name, tp.getDeepUnaliasedType()) + ) + } + + override InterfaceType getDeepUnaliasedType() { + result = this.getDeepUnaliasedTypeCandidate() and + exists(int nComponents | + nComponents = count(int i | isInterfaceComponentWithQualifiedName(this, i, _, _) and i >= 0) + | + this.hasDeepUnaliasedComponentTypesUpTo(result, nComponents - 1) + or + nComponents <= 5 + ) and + exists(int nEmbeds | + nEmbeds = count(int i | isInterfaceComponentWithQualifiedName(this, i, _, _) and i < 0) + | + // Note no -1 here, because the first embedded type is at -1 + this.hasDeepUnaliasedEmbeddedTypesUpTo(result, nEmbeds) + or + nEmbeds <= 2 + ) + } + language[monotonicAggregates] override string pp() { exists(string comp, string sep1, string ts, string sep2, string meth | @@ -922,11 +1248,60 @@ class ComparableType extends NamedType { ComparableType() { this.getName() = "comparable" } } +pragma[nomagic] +private predicate unpackTupleType( + TupleType tt, TOptType c0, TOptType c1, TOptType c2, int nComponents +) { + nComponents = count(int i | component_types(tt, i, _, _)) and + (if nComponents >= 1 then c0 = MkSomeType(tt.getComponentType(0)) else c0 = MkNoType()) and + (if nComponents >= 2 then c1 = MkSomeType(tt.getComponentType(1)) else c1 = MkNoType()) and + (if nComponents >= 3 then c2 = MkSomeType(tt.getComponentType(2)) else c2 = MkNoType()) +} + +pragma[nomagic] +private predicate unpackAndUnaliasTupleType( + TupleType tt, TOptType c0, TOptType c1, TOptType c2, int nComponents +) { + exists(OptType c0a, OptType c1a, OptType c2a | + unpackTupleType(tt, c0a, c1a, c2a, nComponents) and + c0 = c0a.getDeepUnaliasedType() and + c1 = c1a.getDeepUnaliasedType() and + c2 = c2a.getDeepUnaliasedType() + ) +} + /** A tuple type. */ class TupleType extends @tupletype, CompositeType { /** Gets the `i`th component type of this tuple type. */ Type getComponentType(int i) { component_types(this, i, _, result) } + private TupleType getCandidateDeepUnaliasedType() { + exists(OptType c0, OptType c1, OptType c2, int nComponents | + unpackAndUnaliasTupleType(this, c0, c1, c2, nComponents) and + unpackTupleType(result, c0, c1, c2, nComponents) + ) + } + + private predicate isDeepUnaliasedTypeUpTo(TupleType tt, int i) { + tt = this.getCandidateDeepUnaliasedType() and + i >= 3 and + ( + i = 3 + or + this.isDeepUnaliasedTypeUpTo(tt, i - 1) + ) and + tt.getComponentType(i) = this.getComponentType(i).getDeepUnaliasedType() + } + + override TupleType getDeepUnaliasedType() { + result = this.getCandidateDeepUnaliasedType() and + exists(int nComponents | nComponents = count(int i | component_types(this, i, _, _)) | + this.isDeepUnaliasedTypeUpTo(result, nComponents - 1) + or + nComponents <= 3 + ) + } + language[monotonicAggregates] override string pp() { result = @@ -936,6 +1311,68 @@ class TupleType extends @tupletype, CompositeType { override string toString() { result = "tuple type" } } +// Reasonably efficiently map from a signature type to its +// deep-unaliased equivalent, by using a single join for the leading 5 parameters +// and/or 3 results. +private newtype TOptType = + MkNoType() or + MkSomeType(Type tp) + +private class OptType extends TOptType { + OptType getDeepUnaliasedType() { + exists(Type t | this = MkSomeType(t) | result = MkSomeType(t.getDeepUnaliasedType())) + or + this = MkNoType() and result = MkNoType() + } + + string toString() { + exists(Type t | this = MkSomeType(t) | result = t.toString()) + or + this = MkNoType() and result = "no type" + } +} + +pragma[nomagic] +private predicate unpackSignatureType( + SignatureType sig, OptType param0, OptType param1, OptType param2, OptType param3, OptType param4, + int nParams, OptType result0, OptType result1, OptType result2, int nResults, boolean isVariadic +) { + nParams = sig.getNumParameter() and + nResults = sig.getNumResult() and + (if nParams >= 1 then param0 = MkSomeType(sig.getParameterType(0)) else param0 = MkNoType()) and + (if nParams >= 2 then param1 = MkSomeType(sig.getParameterType(1)) else param1 = MkNoType()) and + (if nParams >= 3 then param2 = MkSomeType(sig.getParameterType(2)) else param2 = MkNoType()) and + (if nParams >= 4 then param3 = MkSomeType(sig.getParameterType(3)) else param3 = MkNoType()) and + (if nParams >= 5 then param4 = MkSomeType(sig.getParameterType(4)) else param4 = MkNoType()) and + (if nResults >= 1 then result0 = MkSomeType(sig.getResultType(0)) else result0 = MkNoType()) and + (if nResults >= 2 then result1 = MkSomeType(sig.getResultType(1)) else result1 = MkNoType()) and + (if nResults >= 3 then result2 = MkSomeType(sig.getResultType(2)) else result2 = MkNoType()) and + (if sig.isVariadic() then isVariadic = true else isVariadic = false) +} + +pragma[nomagic] +private predicate unpackAndUnaliasSignatureType( + SignatureType sig, OptType param0, OptType param1, OptType param2, OptType param3, OptType param4, + int nParams, OptType result0, OptType result1, OptType result2, int nResults, boolean isVariadic +) { + exists( + OptType param0a, OptType param1a, OptType param2a, OptType param3a, OptType param4a, + OptType result0a, OptType result1a, OptType result2a + | + unpackSignatureType(sig, param0a, param1a, param2a, param3a, param4a, nParams, result0a, + result1a, result2a, nResults, isVariadic) + | + param0 = param0a.getDeepUnaliasedType() and + param1 = param1a.getDeepUnaliasedType() and + param2 = param2a.getDeepUnaliasedType() and + param3 = param3a.getDeepUnaliasedType() and + param4 = param4a.getDeepUnaliasedType() and + result0 = result0a.getDeepUnaliasedType() and + result1 = result1a.getDeepUnaliasedType() and + result2 = result2a.getDeepUnaliasedType() + ) +} + /** A signature type. */ class SignatureType extends @signaturetype, CompositeType { /** Gets the `i`th parameter type of this signature type. */ @@ -953,6 +1390,53 @@ class SignatureType extends @signaturetype, CompositeType { /** Holds if this signature type is variadic. */ predicate isVariadic() { variadic(this) } + private SignatureType getDeepUnaliasedTypeCandidate() { + exists( + OptType param0, OptType param1, OptType param2, OptType param3, OptType param4, int nParams, + OptType result0, OptType result1, OptType result2, int nResults, boolean isVariadic + | + unpackAndUnaliasSignatureType(this, param0, param1, param2, param3, param4, nParams, result0, + result1, result2, nResults, isVariadic) and + unpackSignatureType(result, param0, param1, param2, param3, param4, nParams, result0, result1, + result2, nResults, isVariadic) + ) + } + + // These incremental recursive implementations only apply from parameter 5 or result 3 + // upwards to avoid constructing large squares of candidates -- the initial parameters + // and results are taken care of by the candidate predicate. + private predicate hasDeepUnaliasedParameterTypesUpTo(SignatureType unaliased, int i) { + unaliased = this.getDeepUnaliasedTypeCandidate() and + i >= 5 and + (i = 5 or this.hasDeepUnaliasedParameterTypesUpTo(unaliased, i - 1)) and + unaliased.getParameterType(i) = this.getParameterType(i).getDeepUnaliasedType() + } + + private predicate hasDeepUnaliasedResultTypesUpTo(SignatureType unaliased, int i) { + unaliased = this.getDeepUnaliasedTypeCandidate() and + i >= 3 and + (i = 3 or this.hasDeepUnaliasedResultTypesUpTo(unaliased, i - 1)) and + unaliased.getResultType(i) = this.getResultType(i).getDeepUnaliasedType() + } + + override SignatureType getDeepUnaliasedType() { + result = this.getDeepUnaliasedTypeCandidate() and + exists(int nParams, int nResults | + this.getNumParameter() = nParams and this.getNumResult() = nResults + | + ( + nParams <= 5 + or + this.hasDeepUnaliasedParameterTypesUpTo(result, nParams - 1) + ) and + ( + nResults <= 3 + or + this.hasDeepUnaliasedResultTypesUpTo(result, nResults - 1) + ) + ) + } + language[monotonicAggregates] override string pp() { result = @@ -982,6 +1466,11 @@ class MapType extends @maptype, CompositeType { /** Gets the value type of this map type. */ Type getValueType() { element_type(this, result) } + override MapType getDeepUnaliasedType() { + result.getKeyType() = this.getKeyType().getDeepUnaliasedType() and + result.getValueType() = this.getValueType().getDeepUnaliasedType() + } + override string pp() { result = "[" + this.getKeyType().pp() + "]" + this.getValueType().pp() } override string toString() { result = "map type" } @@ -1006,6 +1495,10 @@ class SendChanType extends @sendchantype, ChanType { override string pp() { result = "chan<- " + this.getElementType().pp() } override string toString() { result = "send-channel type" } + + override SendChanType getDeepUnaliasedType() { + result.getElementType() = this.getElementType().getDeepUnaliasedType() + } } /** A channel type that can only receive. */ @@ -1015,6 +1508,10 @@ class RecvChanType extends @recvchantype, ChanType { override string pp() { result = "<-chan " + this.getElementType().pp() } override string toString() { result = "receive-channel type" } + + override RecvChanType getDeepUnaliasedType() { + result.getElementType() = this.getElementType().getDeepUnaliasedType() + } } /** A channel type that can both send and receive. */ @@ -1026,6 +1523,10 @@ class SendRecvChanType extends @sendrcvchantype, ChanType { override string pp() { result = "chan " + this.getElementType().pp() } override string toString() { result = "send-receive-channel type" } + + override SendRecvChanType getDeepUnaliasedType() { + result.getElementType() = this.getElementType().getDeepUnaliasedType() + } } /** A named type. */ @@ -1058,6 +1559,27 @@ class NamedType extends @namedtype, CompositeType { override Type getUnderlyingType() { result = this.getBaseType().getUnderlyingType() } } +/** An alias type. */ +class AliasType extends @typealias, CompositeType { + /** Gets the aliased type (i.e. that appears on the RHS of the alias definition). */ + Type getRhs() { alias_rhs(this, result) } + + override Type getUnderlyingType() { result = unalias(this).getUnderlyingType() } + + override Type getDeepUnaliasedType() { result = unalias(this).getDeepUnaliasedType() } +} + +/** + * Gets the non-alias type at the end of the alias chain starting at `t`. + * + * If `t` is not an alias type then `result` is `t`. + */ +Type unalias(Type t) { + not t instanceof AliasType and result = t + or + result = unalias(t.(AliasType).getRhs()) +} + /** * A type that implements the builtin interface `error`. */ diff --git a/go/ql/lib/semmle/go/dataflow/internal/ContainerFlow.qll b/go/ql/lib/semmle/go/dataflow/internal/ContainerFlow.qll index 9f07693b7ea2..dd1a3dfd8ff5 100644 --- a/go/ql/lib/semmle/go/dataflow/internal/ContainerFlow.qll +++ b/go/ql/lib/semmle/go/dataflow/internal/ContainerFlow.qll @@ -57,7 +57,7 @@ predicate containerStoreStep(Node node1, Node node2, Content c) { * as well as array iteration through enhanced `for` statements. */ predicate containerReadStep(Node node1, Node node2, Content c) { - exists(Type t | t = node1.getType().getUnderlyingType() | + exists(Type t | t = node1.getType().getUnderlyingType().getDeepUnaliasedType() | c instanceof ArrayContent and ( t instanceof ArrayType or diff --git a/go/ql/lib/semmle/go/dataflow/internal/DataFlowPrivate.qll b/go/ql/lib/semmle/go/dataflow/internal/DataFlowPrivate.qll index f9e569089bef..5f30daafa427 100644 --- a/go/ql/lib/semmle/go/dataflow/internal/DataFlowPrivate.qll +++ b/go/ql/lib/semmle/go/dataflow/internal/DataFlowPrivate.qll @@ -154,11 +154,15 @@ predicate storeStep(Node node1, ContentSet cs, Node node2) { or node1 = base and node2.(PostUpdateNode).getPreUpdateNode() = node1.(PointerDereferenceNode).getOperand() and - c = any(DataFlow::PointerContent pc | pc.getPointerType() = node2.getType()) + c = + any(DataFlow::PointerContent pc | + pc.getPointerType() = node2.getType().getDeepUnaliasedType() + ) ) or node1 = node2.(AddressOperationNode).getOperand() and - c = any(DataFlow::PointerContent pc | pc.getPointerType() = node2.getType()) + c = + any(DataFlow::PointerContent pc | pc.getPointerType() = node2.getType().getDeepUnaliasedType()) or containerStoreStep(node1, node2, c) ) @@ -175,12 +179,22 @@ predicate storeStep(Node node1, ContentSet cs, Node node2) { predicate readStep(Node node1, ContentSet cs, Node node2) { exists(Content c | cs.asOneContent() = c | node1 = node2.(PointerDereferenceNode).getOperand() and - c = any(DataFlow::PointerContent pc | pc.getPointerType() = node1.getType()) + c = + any(DataFlow::PointerContent pc | + pc.getPointerType().getDeepUnaliasedType() = node1.getType().getDeepUnaliasedType() + ) or exists(FieldReadNode read | node2 = read and node1 = read.getBase() and - c = any(DataFlow::FieldContent fc | fc.getField() = read.getField()) + exists(DataFlow::FieldContent fc, Field f1, Field f2 | + f1 = fc.getField() and + f2 = read.getField() and + f1.getDeclaringType().getDeepUnaliasedType() = f2.getDeclaringType().getDeepUnaliasedType() and + f1.getName() = f2.getName() + | + c = fc + ) ) or containerReadStep(node1, node2, c) diff --git a/go/ql/lib/semmle/go/dataflow/internal/TaintTrackingUtil.qll b/go/ql/lib/semmle/go/dataflow/internal/TaintTrackingUtil.qll index c69a7f32e63b..41141bcdf190 100644 --- a/go/ql/lib/semmle/go/dataflow/internal/TaintTrackingUtil.qll +++ b/go/ql/lib/semmle/go/dataflow/internal/TaintTrackingUtil.qll @@ -35,11 +35,11 @@ predicate localTaintStep(DataFlow::Node src, DataFlow::Node sink) { } private Type getElementType(Type containerType) { - result = containerType.(ArrayType).getElementType() or - result = containerType.(SliceType).getElementType() or - result = containerType.(ChanType).getElementType() or - result = containerType.(MapType).getValueType() or - result = containerType.(PointerType).getPointerType() + result = containerType.getDeepUnaliasedType().(ArrayType).getElementType() or + result = containerType.getDeepUnaliasedType().(SliceType).getElementType() or + result = containerType.getDeepUnaliasedType().(ChanType).getElementType() or + result = containerType.getDeepUnaliasedType().(MapType).getValueType() or + result = containerType.getDeepUnaliasedType().(PointerType).getPointerType() } /** @@ -50,7 +50,7 @@ bindingset[node] predicate defaultImplicitTaintRead(DataFlow::Node node, DataFlow::ContentSet cs) { exists(Type containerType, DataFlow::Content c | node instanceof DataFlow::ArgumentNode and - getElementType*(node.getType()) = containerType and + getElementType*(node.getType()).getDeepUnaliasedType() = containerType and cs.asOneContent() = c | containerType instanceof ArrayType and @@ -65,7 +65,7 @@ predicate defaultImplicitTaintRead(DataFlow::Node node, DataFlow::ContentSet cs) containerType instanceof MapType and c instanceof DataFlow::MapValueContent or - c.(DataFlow::PointerContent).getPointerType() = containerType + c.(DataFlow::PointerContent).getPointerType().getDeepUnaliasedType() = containerType ) } diff --git a/go/ql/lib/semmle/go/frameworks/NoSQL.qll b/go/ql/lib/semmle/go/frameworks/NoSQL.qll index 36932149628e..3326005c60ac 100644 --- a/go/ql/lib/semmle/go/frameworks/NoSQL.qll +++ b/go/ql/lib/semmle/go/frameworks/NoSQL.qll @@ -40,7 +40,8 @@ module NoSql { // Taint an entry if the `Value` is tainted exists(Write w, DataFlow::Node base, Field f | w.writesField(base, f, pred) | base = succ.(DataFlow::PostUpdateNode).getPreUpdateNode() and - base.getType().hasQualifiedName(package("go.mongodb.org/mongo-driver", "bson/primitive"), "E") and + unalias(base.getType()) + .hasQualifiedName(package("go.mongodb.org/mongo-driver", "bson/primitive"), "E") and f.getName() = "Value" ) } diff --git a/go/ql/lib/upgrades/4bd57e093275e5e892dfb16b55ed4bd76ea662be/go.dbscheme b/go/ql/lib/upgrades/4bd57e093275e5e892dfb16b55ed4bd76ea662be/go.dbscheme new file mode 100644 index 000000000000..20cbf29a0803 --- /dev/null +++ b/go/ql/lib/upgrades/4bd57e093275e5e892dfb16b55ed4bd76ea662be/go.dbscheme @@ -0,0 +1,555 @@ +/** Auto-generated dbscheme; do not edit. Run `make gen` in directory `go/` to regenerate. */ + + +/** Duplicate code **/ + +duplicateCode( + unique int id : @duplication, + varchar(900) relativePath : string ref, + int equivClass : int ref); + +similarCode( + unique int id : @similarity, + varchar(900) relativePath : string ref, + int equivClass : int ref); + +@duplication_or_similarity = @duplication | @similarity; + +tokens( + int id : @duplication_or_similarity ref, + int offset : int ref, + int beginLine : int ref, + int beginColumn : int ref, + int endLine : int ref, + int endColumn : int ref); + +/** External data **/ + +externalData( + int id : @externalDataElement, + varchar(900) path : string ref, + int column: int ref, + varchar(900) value : string ref +); + +snapshotDate(unique date snapshotDate : date ref); + +sourceLocationPrefix(varchar(900) prefix : string ref); + + +/* + * XML Files + */ + +xmlEncoding( + unique int id: @file ref, + string encoding: string ref +); + +xmlDTDs( + unique int id: @xmldtd, + string root: string ref, + string publicId: string ref, + string systemId: string ref, + int fileid: @file ref +); + +xmlElements( + unique int id: @xmlelement, + string name: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int fileid: @file ref +); + +xmlAttrs( + unique int id: @xmlattribute, + int elementid: @xmlelement ref, + string name: string ref, + string value: string ref, + int idx: int ref, + int fileid: @file ref +); + +xmlNs( + int id: @xmlnamespace, + string prefixName: string ref, + string URI: string ref, + int fileid: @file ref +); + +xmlHasNs( + int elementId: @xmlnamespaceable ref, + int nsId: @xmlnamespace ref, + int fileid: @file ref +); + +xmlComments( + unique int id: @xmlcomment, + string text: string ref, + int parentid: @xmlparent ref, + int fileid: @file ref +); + +xmlChars( + unique int id: @xmlcharacters, + string text: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int isCDATA: int ref, + int fileid: @file ref +); + +@xmlparent = @file | @xmlelement; +@xmlnamespaceable = @xmlelement | @xmlattribute; + +xmllocations( + int xmlElement: @xmllocatable ref, + int location: @location_default ref +); + +@xmllocatable = @xmlcharacters | @xmlelement | @xmlcomment | @xmlattribute | @xmldtd | @file | @xmlnamespace; + +compilations(unique int id: @compilation, string cwd: string ref); + +#keyset[id, num] +compilation_args(int id: @compilation ref, int num: int ref, string arg: string ref); + +#keyset[id, num, kind] +compilation_time(int id: @compilation ref, int num: int ref, int kind: int ref, float secs: float ref); + +diagnostic_for(unique int diagnostic: @diagnostic ref, int compilation: @compilation ref, int file_number: int ref, int file_number_diagnostic_number: int ref); + +compilation_finished(unique int id: @compilation ref, float cpu_seconds: float ref, float elapsed_seconds: float ref); + +#keyset[id, num] +compilation_compiling_files(int id: @compilation ref, int num: int ref, int file: @file ref); + +diagnostics(unique int id: @diagnostic, int severity: int ref, string error_tag: string ref, string error_message: string ref, + string full_error_message: string ref, int location: @location ref); + +locations_default(unique int id: @location_default, int file: @file ref, int beginLine: int ref, int beginColumn: int ref, + int endLine: int ref, int endColumn: int ref); + +numlines(int element_id: @sourceline ref, int num_lines: int ref, int num_code: int ref, int num_comment: int ref); + +files(unique int id: @file, string name: string ref); + +folders(unique int id: @folder, string name: string ref); + +containerparent(int parent: @container ref, unique int child: @container ref); + +has_location(unique int locatable: @locatable ref, int location: @location ref); + +#keyset[parent, idx] +comment_groups(unique int id: @comment_group, int parent: @file ref, int idx: int ref); + +comments(unique int id: @comment, int kind: int ref, int parent: @comment_group ref, int idx: int ref, string text: string ref); + +doc_comments(unique int node: @documentable ref, int comment: @comment_group ref); + +#keyset[parent, idx] +exprs(unique int id: @expr, int kind: int ref, int parent: @exprparent ref, int idx: int ref); + +literals(unique int expr: @expr ref, string value: string ref, string raw: string ref); + +constvalues(unique int expr: @expr ref, string value: string ref, string exact: string ref); + +fields(unique int id: @field, int parent: @fieldparent ref, int idx: int ref); + +typeparamdecls(unique int id: @typeparamdecl, int parent: @typeparamdeclparent ref, int idx: int ref); + +#keyset[parent, idx] +stmts(unique int id: @stmt, int kind: int ref, int parent: @stmtparent ref, int idx: int ref); + +#keyset[parent, idx] +decls(unique int id: @decl, int kind: int ref, int parent: @declparent ref, int idx: int ref); + +#keyset[parent, idx] +specs(unique int id: @spec, int kind: int ref, int parent: @gendecl ref, int idx: int ref); + +scopes(unique int id: @scope, int kind: int ref); + +scopenesting(unique int inner: @scope ref, int outer: @scope ref); + +scopenodes(unique int node: @scopenode ref, int scope: @localscope ref); + +objects(unique int id: @object, int kind: int ref, string name: string ref); + +objectscopes(unique int object: @object ref, int scope: @scope ref); + +objecttypes(unique int object: @object ref, int tp: @type ref); + +methodreceivers(unique int method: @object ref, int receiver: @object ref); + +fieldstructs(unique int field: @object ref, int struct: @structtype ref); + +methodhosts(int method: @object ref, int host: @namedtype ref); + +defs(int ident: @ident ref, int object: @object ref); + +uses(int ident: @ident ref, int object: @object ref); + +types(unique int id: @type, int kind: int ref); + +type_of(unique int expr: @expr ref, int tp: @type ref); + +typename(unique int tp: @type ref, string name: string ref); + +key_type(unique int map: @maptype ref, int tp: @type ref); + +element_type(unique int container: @containertype ref, int tp: @type ref); + +base_type(unique int ptr: @pointertype ref, int tp: @type ref); + +underlying_type(unique int named: @namedtype ref, int tp: @type ref); + +alias_rhs(unique int alias: @typealias ref, int tp: @type ref); + +#keyset[parent, index] +component_types(int parent: @compositetype ref, int index: int ref, string name: string ref, int tp: @type ref); + +#keyset[parent, index] +struct_tags(int parent: @structtype ref, int index: int ref, string tag: string ref); + +#keyset[interface, index] +interface_private_method_ids(int interface: @interfacetype ref, int index: int ref, string id: string ref); + +array_length(unique int tp: @arraytype ref, string len: string ref); + +type_objects(unique int tp: @type ref, int object: @object ref); + +packages(unique int id: @package, string name: string ref, string path: string ref, int scope: @packagescope ref); + +#keyset[parent, idx] +modexprs(unique int id: @modexpr, int kind: int ref, int parent: @modexprparent ref, int idx: int ref); + +#keyset[parent, idx] +modtokens(string token: string ref, int parent: @modexpr ref, int idx: int ref); + +#keyset[package, idx] +errors(unique int id: @error, int kind: int ref, string msg: string ref, string rawpos: string ref, + string file: string ref, int line: int ref, int col: int ref, int package: @package ref, int idx: int ref); + +has_ellipsis(int id: @callorconversionexpr ref); + +variadic(int id: @signaturetype ref); + +#keyset[parent, idx] +typeparam(unique int tp: @typeparamtype ref, string name: string ref, int bound: @compositetype ref, + int parent: @typeparamparentobject ref, int idx: int ref); + +@container = @file | @folder; + +@locatable = @xmllocatable | @node | @localscope; + +@node = @documentable | @exprparent | @modexprparent | @fieldparent | @stmtparent | @declparent | @typeparamdeclparent + | @scopenode | @comment_group | @comment; + +@documentable = @file | @field | @typeparamdecl | @spec | @gendecl | @funcdecl | @modexpr; + +@exprparent = @funcdef | @file | @expr | @field | @stmt | @decl | @typeparamdecl | @spec; + +@modexprparent = @file | @modexpr; + +@fieldparent = @decl | @structtypeexpr | @functypeexpr | @interfacetypeexpr; + +@stmtparent = @funcdef | @stmt | @decl; + +@declparent = @file | @declstmt; + +@typeparamdeclparent = @funcdecl | @typespec; + +@funcdef = @funclit | @funcdecl; + +@scopenode = @file | @functypeexpr | @blockstmt | @ifstmt | @caseclause | @switchstmt | @commclause | @loopstmt; + +@location = @location_default; + +@sourceline = @locatable; + +case @comment.kind of + 0 = @slashslashcomment +| 1 = @slashstarcomment; + +case @expr.kind of + 0 = @badexpr +| 1 = @ident +| 2 = @ellipsis +| 3 = @intlit +| 4 = @floatlit +| 5 = @imaglit +| 6 = @charlit +| 7 = @stringlit +| 8 = @funclit +| 9 = @compositelit +| 10 = @parenexpr +| 11 = @selectorexpr +| 12 = @indexexpr +| 13 = @genericfunctioninstantiationexpr +| 14 = @generictypeinstantiationexpr +| 15 = @sliceexpr +| 16 = @typeassertexpr +| 17 = @callorconversionexpr +| 18 = @starexpr +| 19 = @keyvalueexpr +| 20 = @arraytypeexpr +| 21 = @structtypeexpr +| 22 = @functypeexpr +| 23 = @interfacetypeexpr +| 24 = @maptypeexpr +| 25 = @typesetliteralexpr +| 26 = @plusexpr +| 27 = @minusexpr +| 28 = @notexpr +| 29 = @complementexpr +| 30 = @derefexpr +| 31 = @addressexpr +| 32 = @arrowexpr +| 33 = @lorexpr +| 34 = @landexpr +| 35 = @eqlexpr +| 36 = @neqexpr +| 37 = @lssexpr +| 38 = @leqexpr +| 39 = @gtrexpr +| 40 = @geqexpr +| 41 = @addexpr +| 42 = @subexpr +| 43 = @orexpr +| 44 = @xorexpr +| 45 = @mulexpr +| 46 = @quoexpr +| 47 = @remexpr +| 48 = @shlexpr +| 49 = @shrexpr +| 50 = @andexpr +| 51 = @andnotexpr +| 52 = @sendchantypeexpr +| 53 = @recvchantypeexpr +| 54 = @sendrcvchantypeexpr; + +@basiclit = @intlit | @floatlit | @imaglit | @charlit | @stringlit; + +@operatorexpr = @logicalexpr | @arithmeticexpr | @bitwiseexpr | @unaryexpr | @binaryexpr; + +@logicalexpr = @logicalunaryexpr | @logicalbinaryexpr; + +@arithmeticexpr = @arithmeticunaryexpr | @arithmeticbinaryexpr; + +@bitwiseexpr = @bitwiseunaryexpr | @bitwisebinaryexpr; + +@unaryexpr = @logicalunaryexpr | @bitwiseunaryexpr | @arithmeticunaryexpr | @derefexpr | @addressexpr | @arrowexpr; + +@logicalunaryexpr = @notexpr; + +@bitwiseunaryexpr = @complementexpr; + +@arithmeticunaryexpr = @plusexpr | @minusexpr; + +@binaryexpr = @logicalbinaryexpr | @bitwisebinaryexpr | @arithmeticbinaryexpr | @comparison; + +@logicalbinaryexpr = @lorexpr | @landexpr; + +@bitwisebinaryexpr = @shiftexpr | @orexpr | @xorexpr | @andexpr | @andnotexpr; + +@arithmeticbinaryexpr = @addexpr | @subexpr | @mulexpr | @quoexpr | @remexpr; + +@shiftexpr = @shlexpr | @shrexpr; + +@comparison = @equalitytest | @relationalcomparison; + +@equalitytest = @eqlexpr | @neqexpr; + +@relationalcomparison = @lssexpr | @leqexpr | @gtrexpr | @geqexpr; + +@chantypeexpr = @sendchantypeexpr | @recvchantypeexpr | @sendrcvchantypeexpr; + +case @stmt.kind of + 0 = @badstmt +| 1 = @declstmt +| 2 = @emptystmt +| 3 = @labeledstmt +| 4 = @exprstmt +| 5 = @sendstmt +| 6 = @incstmt +| 7 = @decstmt +| 8 = @gostmt +| 9 = @deferstmt +| 10 = @returnstmt +| 11 = @breakstmt +| 12 = @continuestmt +| 13 = @gotostmt +| 14 = @fallthroughstmt +| 15 = @blockstmt +| 16 = @ifstmt +| 17 = @caseclause +| 18 = @exprswitchstmt +| 19 = @typeswitchstmt +| 20 = @commclause +| 21 = @selectstmt +| 22 = @forstmt +| 23 = @rangestmt +| 24 = @assignstmt +| 25 = @definestmt +| 26 = @addassignstmt +| 27 = @subassignstmt +| 28 = @mulassignstmt +| 29 = @quoassignstmt +| 30 = @remassignstmt +| 31 = @andassignstmt +| 32 = @orassignstmt +| 33 = @xorassignstmt +| 34 = @shlassignstmt +| 35 = @shrassignstmt +| 36 = @andnotassignstmt; + +@incdecstmt = @incstmt | @decstmt; + +@assignment = @simpleassignstmt | @compoundassignstmt; + +@simpleassignstmt = @assignstmt | @definestmt; + +@compoundassignstmt = @addassignstmt | @subassignstmt | @mulassignstmt | @quoassignstmt | @remassignstmt + | @andassignstmt | @orassignstmt | @xorassignstmt | @shlassignstmt | @shrassignstmt | @andnotassignstmt; + +@branchstmt = @breakstmt | @continuestmt | @gotostmt | @fallthroughstmt; + +@switchstmt = @exprswitchstmt | @typeswitchstmt; + +@loopstmt = @forstmt | @rangestmt; + +case @decl.kind of + 0 = @baddecl +| 1 = @importdecl +| 2 = @constdecl +| 3 = @typedecl +| 4 = @vardecl +| 5 = @funcdecl; + +@gendecl = @importdecl | @constdecl | @typedecl | @vardecl; + +case @spec.kind of + 0 = @importspec +| 1 = @valuespec +| 2 = @typedefspec +| 3 = @aliasspec; + +@typespec = @typedefspec | @aliasspec; + +case @object.kind of + 0 = @pkgobject +| 1 = @decltypeobject +| 2 = @builtintypeobject +| 3 = @declconstobject +| 4 = @builtinconstobject +| 5 = @declvarobject +| 6 = @declfunctionobject +| 7 = @builtinfunctionobject +| 8 = @labelobject; + +@typeparamparentobject = @decltypeobject | @declfunctionobject; + +@declobject = @decltypeobject | @declconstobject | @declvarobject | @declfunctionobject; + +@builtinobject = @builtintypeobject | @builtinconstobject | @builtinfunctionobject; + +@typeobject = @decltypeobject | @builtintypeobject; + +@valueobject = @constobject | @varobject | @functionobject; + +@constobject = @declconstobject | @builtinconstobject; + +@varobject = @declvarobject; + +@functionobject = @declfunctionobject | @builtinfunctionobject; + +case @scope.kind of + 0 = @universescope +| 1 = @packagescope +| 2 = @localscope; + +case @type.kind of + 0 = @invalidtype +| 1 = @boolexprtype +| 2 = @inttype +| 3 = @int8type +| 4 = @int16type +| 5 = @int32type +| 6 = @int64type +| 7 = @uinttype +| 8 = @uint8type +| 9 = @uint16type +| 10 = @uint32type +| 11 = @uint64type +| 12 = @uintptrtype +| 13 = @float32type +| 14 = @float64type +| 15 = @complex64type +| 16 = @complex128type +| 17 = @stringexprtype +| 18 = @unsafepointertype +| 19 = @boolliteraltype +| 20 = @intliteraltype +| 21 = @runeliteraltype +| 22 = @floatliteraltype +| 23 = @complexliteraltype +| 24 = @stringliteraltype +| 25 = @nilliteraltype +| 26 = @typeparamtype +| 27 = @arraytype +| 28 = @slicetype +| 29 = @structtype +| 30 = @pointertype +| 31 = @interfacetype +| 32 = @tupletype +| 33 = @signaturetype +| 34 = @maptype +| 35 = @sendchantype +| 36 = @recvchantype +| 37 = @sendrcvchantype +| 38 = @namedtype +| 39 = @typesetliteraltype +| 40 = @typealias; + +@basictype = @booltype | @numerictype | @stringtype | @literaltype | @invalidtype | @unsafepointertype; + +@booltype = @boolexprtype | @boolliteraltype; + +@numerictype = @integertype | @floattype | @complextype; + +@integertype = @signedintegertype | @unsignedintegertype; + +@signedintegertype = @inttype | @int8type | @int16type | @int32type | @int64type | @intliteraltype | @runeliteraltype; + +@unsignedintegertype = @uinttype | @uint8type | @uint16type | @uint32type | @uint64type | @uintptrtype; + +@floattype = @float32type | @float64type | @floatliteraltype; + +@complextype = @complex64type | @complex128type | @complexliteraltype; + +@stringtype = @stringexprtype | @stringliteraltype; + +@literaltype = @boolliteraltype | @intliteraltype | @runeliteraltype | @floatliteraltype | @complexliteraltype + | @stringliteraltype | @nilliteraltype; + +@compositetype = @typeparamtype | @containertype | @structtype | @pointertype | @interfacetype | @tupletype + | @signaturetype | @namedtype | @typesetliteraltype | @typealias; + +@containertype = @arraytype | @slicetype | @maptype | @chantype; + +@chantype = @sendchantype | @recvchantype | @sendrcvchantype; + +case @modexpr.kind of + 0 = @modcommentblock +| 1 = @modline +| 2 = @modlineblock +| 3 = @modlparen +| 4 = @modrparen; + +case @error.kind of + 0 = @unknownerror +| 1 = @listerror +| 2 = @parseerror +| 3 = @typeerror; + diff --git a/go/ql/lib/upgrades/4bd57e093275e5e892dfb16b55ed4bd76ea662be/old.dbscheme b/go/ql/lib/upgrades/4bd57e093275e5e892dfb16b55ed4bd76ea662be/old.dbscheme new file mode 100644 index 000000000000..4bd57e093275 --- /dev/null +++ b/go/ql/lib/upgrades/4bd57e093275e5e892dfb16b55ed4bd76ea662be/old.dbscheme @@ -0,0 +1,552 @@ +/** Auto-generated dbscheme; do not edit. Run `make gen` in directory `go/` to regenerate. */ + + +/** Duplicate code **/ + +duplicateCode( + unique int id : @duplication, + varchar(900) relativePath : string ref, + int equivClass : int ref); + +similarCode( + unique int id : @similarity, + varchar(900) relativePath : string ref, + int equivClass : int ref); + +@duplication_or_similarity = @duplication | @similarity; + +tokens( + int id : @duplication_or_similarity ref, + int offset : int ref, + int beginLine : int ref, + int beginColumn : int ref, + int endLine : int ref, + int endColumn : int ref); + +/** External data **/ + +externalData( + int id : @externalDataElement, + varchar(900) path : string ref, + int column: int ref, + varchar(900) value : string ref +); + +snapshotDate(unique date snapshotDate : date ref); + +sourceLocationPrefix(varchar(900) prefix : string ref); + + +/* + * XML Files + */ + +xmlEncoding( + unique int id: @file ref, + string encoding: string ref +); + +xmlDTDs( + unique int id: @xmldtd, + string root: string ref, + string publicId: string ref, + string systemId: string ref, + int fileid: @file ref +); + +xmlElements( + unique int id: @xmlelement, + string name: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int fileid: @file ref +); + +xmlAttrs( + unique int id: @xmlattribute, + int elementid: @xmlelement ref, + string name: string ref, + string value: string ref, + int idx: int ref, + int fileid: @file ref +); + +xmlNs( + int id: @xmlnamespace, + string prefixName: string ref, + string URI: string ref, + int fileid: @file ref +); + +xmlHasNs( + int elementId: @xmlnamespaceable ref, + int nsId: @xmlnamespace ref, + int fileid: @file ref +); + +xmlComments( + unique int id: @xmlcomment, + string text: string ref, + int parentid: @xmlparent ref, + int fileid: @file ref +); + +xmlChars( + unique int id: @xmlcharacters, + string text: string ref, + int parentid: @xmlparent ref, + int idx: int ref, + int isCDATA: int ref, + int fileid: @file ref +); + +@xmlparent = @file | @xmlelement; +@xmlnamespaceable = @xmlelement | @xmlattribute; + +xmllocations( + int xmlElement: @xmllocatable ref, + int location: @location_default ref +); + +@xmllocatable = @xmlcharacters | @xmlelement | @xmlcomment | @xmlattribute | @xmldtd | @file | @xmlnamespace; + +compilations(unique int id: @compilation, string cwd: string ref); + +#keyset[id, num] +compilation_args(int id: @compilation ref, int num: int ref, string arg: string ref); + +#keyset[id, num, kind] +compilation_time(int id: @compilation ref, int num: int ref, int kind: int ref, float secs: float ref); + +diagnostic_for(unique int diagnostic: @diagnostic ref, int compilation: @compilation ref, int file_number: int ref, int file_number_diagnostic_number: int ref); + +compilation_finished(unique int id: @compilation ref, float cpu_seconds: float ref, float elapsed_seconds: float ref); + +#keyset[id, num] +compilation_compiling_files(int id: @compilation ref, int num: int ref, int file: @file ref); + +diagnostics(unique int id: @diagnostic, int severity: int ref, string error_tag: string ref, string error_message: string ref, + string full_error_message: string ref, int location: @location ref); + +locations_default(unique int id: @location_default, int file: @file ref, int beginLine: int ref, int beginColumn: int ref, + int endLine: int ref, int endColumn: int ref); + +numlines(int element_id: @sourceline ref, int num_lines: int ref, int num_code: int ref, int num_comment: int ref); + +files(unique int id: @file, string name: string ref); + +folders(unique int id: @folder, string name: string ref); + +containerparent(int parent: @container ref, unique int child: @container ref); + +has_location(unique int locatable: @locatable ref, int location: @location ref); + +#keyset[parent, idx] +comment_groups(unique int id: @comment_group, int parent: @file ref, int idx: int ref); + +comments(unique int id: @comment, int kind: int ref, int parent: @comment_group ref, int idx: int ref, string text: string ref); + +doc_comments(unique int node: @documentable ref, int comment: @comment_group ref); + +#keyset[parent, idx] +exprs(unique int id: @expr, int kind: int ref, int parent: @exprparent ref, int idx: int ref); + +literals(unique int expr: @expr ref, string value: string ref, string raw: string ref); + +constvalues(unique int expr: @expr ref, string value: string ref, string exact: string ref); + +fields(unique int id: @field, int parent: @fieldparent ref, int idx: int ref); + +typeparamdecls(unique int id: @typeparamdecl, int parent: @typeparamdeclparent ref, int idx: int ref); + +#keyset[parent, idx] +stmts(unique int id: @stmt, int kind: int ref, int parent: @stmtparent ref, int idx: int ref); + +#keyset[parent, idx] +decls(unique int id: @decl, int kind: int ref, int parent: @declparent ref, int idx: int ref); + +#keyset[parent, idx] +specs(unique int id: @spec, int kind: int ref, int parent: @gendecl ref, int idx: int ref); + +scopes(unique int id: @scope, int kind: int ref); + +scopenesting(unique int inner: @scope ref, int outer: @scope ref); + +scopenodes(unique int node: @scopenode ref, int scope: @localscope ref); + +objects(unique int id: @object, int kind: int ref, string name: string ref); + +objectscopes(unique int object: @object ref, int scope: @scope ref); + +objecttypes(unique int object: @object ref, int tp: @type ref); + +methodreceivers(unique int method: @object ref, int receiver: @object ref); + +fieldstructs(unique int field: @object ref, int struct: @structtype ref); + +methodhosts(int method: @object ref, int host: @namedtype ref); + +defs(int ident: @ident ref, int object: @object ref); + +uses(int ident: @ident ref, int object: @object ref); + +types(unique int id: @type, int kind: int ref); + +type_of(unique int expr: @expr ref, int tp: @type ref); + +typename(unique int tp: @type ref, string name: string ref); + +key_type(unique int map: @maptype ref, int tp: @type ref); + +element_type(unique int container: @containertype ref, int tp: @type ref); + +base_type(unique int ptr: @pointertype ref, int tp: @type ref); + +underlying_type(unique int named: @namedtype ref, int tp: @type ref); + +#keyset[parent, index] +component_types(int parent: @compositetype ref, int index: int ref, string name: string ref, int tp: @type ref); + +#keyset[parent, index] +struct_tags(int parent: @structtype ref, int index: int ref, string tag: string ref); + +#keyset[interface, index] +interface_private_method_ids(int interface: @interfacetype ref, int index: int ref, string id: string ref); + +array_length(unique int tp: @arraytype ref, string len: string ref); + +type_objects(unique int tp: @type ref, int object: @object ref); + +packages(unique int id: @package, string name: string ref, string path: string ref, int scope: @packagescope ref); + +#keyset[parent, idx] +modexprs(unique int id: @modexpr, int kind: int ref, int parent: @modexprparent ref, int idx: int ref); + +#keyset[parent, idx] +modtokens(string token: string ref, int parent: @modexpr ref, int idx: int ref); + +#keyset[package, idx] +errors(unique int id: @error, int kind: int ref, string msg: string ref, string rawpos: string ref, + string file: string ref, int line: int ref, int col: int ref, int package: @package ref, int idx: int ref); + +has_ellipsis(int id: @callorconversionexpr ref); + +variadic(int id: @signaturetype ref); + +#keyset[parent, idx] +typeparam(unique int tp: @typeparamtype ref, string name: string ref, int bound: @compositetype ref, + int parent: @typeparamparentobject ref, int idx: int ref); + +@container = @file | @folder; + +@locatable = @xmllocatable | @node | @localscope; + +@node = @documentable | @exprparent | @modexprparent | @fieldparent | @stmtparent | @declparent | @typeparamdeclparent + | @scopenode | @comment_group | @comment; + +@documentable = @file | @field | @typeparamdecl | @spec | @gendecl | @funcdecl | @modexpr; + +@exprparent = @funcdef | @file | @expr | @field | @stmt | @decl | @typeparamdecl | @spec; + +@modexprparent = @file | @modexpr; + +@fieldparent = @decl | @structtypeexpr | @functypeexpr | @interfacetypeexpr; + +@stmtparent = @funcdef | @stmt | @decl; + +@declparent = @file | @declstmt; + +@typeparamdeclparent = @funcdecl | @typespec; + +@funcdef = @funclit | @funcdecl; + +@scopenode = @file | @functypeexpr | @blockstmt | @ifstmt | @caseclause | @switchstmt | @commclause | @loopstmt; + +@location = @location_default; + +@sourceline = @locatable; + +case @comment.kind of + 0 = @slashslashcomment +| 1 = @slashstarcomment; + +case @expr.kind of + 0 = @badexpr +| 1 = @ident +| 2 = @ellipsis +| 3 = @intlit +| 4 = @floatlit +| 5 = @imaglit +| 6 = @charlit +| 7 = @stringlit +| 8 = @funclit +| 9 = @compositelit +| 10 = @parenexpr +| 11 = @selectorexpr +| 12 = @indexexpr +| 13 = @genericfunctioninstantiationexpr +| 14 = @generictypeinstantiationexpr +| 15 = @sliceexpr +| 16 = @typeassertexpr +| 17 = @callorconversionexpr +| 18 = @starexpr +| 19 = @keyvalueexpr +| 20 = @arraytypeexpr +| 21 = @structtypeexpr +| 22 = @functypeexpr +| 23 = @interfacetypeexpr +| 24 = @maptypeexpr +| 25 = @typesetliteralexpr +| 26 = @plusexpr +| 27 = @minusexpr +| 28 = @notexpr +| 29 = @complementexpr +| 30 = @derefexpr +| 31 = @addressexpr +| 32 = @arrowexpr +| 33 = @lorexpr +| 34 = @landexpr +| 35 = @eqlexpr +| 36 = @neqexpr +| 37 = @lssexpr +| 38 = @leqexpr +| 39 = @gtrexpr +| 40 = @geqexpr +| 41 = @addexpr +| 42 = @subexpr +| 43 = @orexpr +| 44 = @xorexpr +| 45 = @mulexpr +| 46 = @quoexpr +| 47 = @remexpr +| 48 = @shlexpr +| 49 = @shrexpr +| 50 = @andexpr +| 51 = @andnotexpr +| 52 = @sendchantypeexpr +| 53 = @recvchantypeexpr +| 54 = @sendrcvchantypeexpr; + +@basiclit = @intlit | @floatlit | @imaglit | @charlit | @stringlit; + +@operatorexpr = @logicalexpr | @arithmeticexpr | @bitwiseexpr | @unaryexpr | @binaryexpr; + +@logicalexpr = @logicalunaryexpr | @logicalbinaryexpr; + +@arithmeticexpr = @arithmeticunaryexpr | @arithmeticbinaryexpr; + +@bitwiseexpr = @bitwiseunaryexpr | @bitwisebinaryexpr; + +@unaryexpr = @logicalunaryexpr | @bitwiseunaryexpr | @arithmeticunaryexpr | @derefexpr | @addressexpr | @arrowexpr; + +@logicalunaryexpr = @notexpr; + +@bitwiseunaryexpr = @complementexpr; + +@arithmeticunaryexpr = @plusexpr | @minusexpr; + +@binaryexpr = @logicalbinaryexpr | @bitwisebinaryexpr | @arithmeticbinaryexpr | @comparison; + +@logicalbinaryexpr = @lorexpr | @landexpr; + +@bitwisebinaryexpr = @shiftexpr | @orexpr | @xorexpr | @andexpr | @andnotexpr; + +@arithmeticbinaryexpr = @addexpr | @subexpr | @mulexpr | @quoexpr | @remexpr; + +@shiftexpr = @shlexpr | @shrexpr; + +@comparison = @equalitytest | @relationalcomparison; + +@equalitytest = @eqlexpr | @neqexpr; + +@relationalcomparison = @lssexpr | @leqexpr | @gtrexpr | @geqexpr; + +@chantypeexpr = @sendchantypeexpr | @recvchantypeexpr | @sendrcvchantypeexpr; + +case @stmt.kind of + 0 = @badstmt +| 1 = @declstmt +| 2 = @emptystmt +| 3 = @labeledstmt +| 4 = @exprstmt +| 5 = @sendstmt +| 6 = @incstmt +| 7 = @decstmt +| 8 = @gostmt +| 9 = @deferstmt +| 10 = @returnstmt +| 11 = @breakstmt +| 12 = @continuestmt +| 13 = @gotostmt +| 14 = @fallthroughstmt +| 15 = @blockstmt +| 16 = @ifstmt +| 17 = @caseclause +| 18 = @exprswitchstmt +| 19 = @typeswitchstmt +| 20 = @commclause +| 21 = @selectstmt +| 22 = @forstmt +| 23 = @rangestmt +| 24 = @assignstmt +| 25 = @definestmt +| 26 = @addassignstmt +| 27 = @subassignstmt +| 28 = @mulassignstmt +| 29 = @quoassignstmt +| 30 = @remassignstmt +| 31 = @andassignstmt +| 32 = @orassignstmt +| 33 = @xorassignstmt +| 34 = @shlassignstmt +| 35 = @shrassignstmt +| 36 = @andnotassignstmt; + +@incdecstmt = @incstmt | @decstmt; + +@assignment = @simpleassignstmt | @compoundassignstmt; + +@simpleassignstmt = @assignstmt | @definestmt; + +@compoundassignstmt = @addassignstmt | @subassignstmt | @mulassignstmt | @quoassignstmt | @remassignstmt + | @andassignstmt | @orassignstmt | @xorassignstmt | @shlassignstmt | @shrassignstmt | @andnotassignstmt; + +@branchstmt = @breakstmt | @continuestmt | @gotostmt | @fallthroughstmt; + +@switchstmt = @exprswitchstmt | @typeswitchstmt; + +@loopstmt = @forstmt | @rangestmt; + +case @decl.kind of + 0 = @baddecl +| 1 = @importdecl +| 2 = @constdecl +| 3 = @typedecl +| 4 = @vardecl +| 5 = @funcdecl; + +@gendecl = @importdecl | @constdecl | @typedecl | @vardecl; + +case @spec.kind of + 0 = @importspec +| 1 = @valuespec +| 2 = @typedefspec +| 3 = @aliasspec; + +@typespec = @typedefspec | @aliasspec; + +case @object.kind of + 0 = @pkgobject +| 1 = @decltypeobject +| 2 = @builtintypeobject +| 3 = @declconstobject +| 4 = @builtinconstobject +| 5 = @declvarobject +| 6 = @declfunctionobject +| 7 = @builtinfunctionobject +| 8 = @labelobject; + +@typeparamparentobject = @decltypeobject | @declfunctionobject; + +@declobject = @decltypeobject | @declconstobject | @declvarobject | @declfunctionobject; + +@builtinobject = @builtintypeobject | @builtinconstobject | @builtinfunctionobject; + +@typeobject = @decltypeobject | @builtintypeobject; + +@valueobject = @constobject | @varobject | @functionobject; + +@constobject = @declconstobject | @builtinconstobject; + +@varobject = @declvarobject; + +@functionobject = @declfunctionobject | @builtinfunctionobject; + +case @scope.kind of + 0 = @universescope +| 1 = @packagescope +| 2 = @localscope; + +case @type.kind of + 0 = @invalidtype +| 1 = @boolexprtype +| 2 = @inttype +| 3 = @int8type +| 4 = @int16type +| 5 = @int32type +| 6 = @int64type +| 7 = @uinttype +| 8 = @uint8type +| 9 = @uint16type +| 10 = @uint32type +| 11 = @uint64type +| 12 = @uintptrtype +| 13 = @float32type +| 14 = @float64type +| 15 = @complex64type +| 16 = @complex128type +| 17 = @stringexprtype +| 18 = @unsafepointertype +| 19 = @boolliteraltype +| 20 = @intliteraltype +| 21 = @runeliteraltype +| 22 = @floatliteraltype +| 23 = @complexliteraltype +| 24 = @stringliteraltype +| 25 = @nilliteraltype +| 26 = @typeparamtype +| 27 = @arraytype +| 28 = @slicetype +| 29 = @structtype +| 30 = @pointertype +| 31 = @interfacetype +| 32 = @tupletype +| 33 = @signaturetype +| 34 = @maptype +| 35 = @sendchantype +| 36 = @recvchantype +| 37 = @sendrcvchantype +| 38 = @namedtype +| 39 = @typesetliteraltype; + +@basictype = @booltype | @numerictype | @stringtype | @literaltype | @invalidtype | @unsafepointertype; + +@booltype = @boolexprtype | @boolliteraltype; + +@numerictype = @integertype | @floattype | @complextype; + +@integertype = @signedintegertype | @unsignedintegertype; + +@signedintegertype = @inttype | @int8type | @int16type | @int32type | @int64type | @intliteraltype | @runeliteraltype; + +@unsignedintegertype = @uinttype | @uint8type | @uint16type | @uint32type | @uint64type | @uintptrtype; + +@floattype = @float32type | @float64type | @floatliteraltype; + +@complextype = @complex64type | @complex128type | @complexliteraltype; + +@stringtype = @stringexprtype | @stringliteraltype; + +@literaltype = @boolliteraltype | @intliteraltype | @runeliteraltype | @floatliteraltype | @complexliteraltype + | @stringliteraltype | @nilliteraltype; + +@compositetype = @typeparamtype | @containertype | @structtype | @pointertype | @interfacetype | @tupletype + | @signaturetype | @namedtype | @typesetliteraltype; + +@containertype = @arraytype | @slicetype | @maptype | @chantype; + +@chantype = @sendchantype | @recvchantype | @sendrcvchantype; + +case @modexpr.kind of + 0 = @modcommentblock +| 1 = @modline +| 2 = @modlineblock +| 3 = @modlparen +| 4 = @modrparen; + +case @error.kind of + 0 = @unknownerror +| 1 = @listerror +| 2 = @parseerror +| 3 = @typeerror; + diff --git a/go/ql/lib/upgrades/4bd57e093275e5e892dfb16b55ed4bd76ea662be/upgrade.properties b/go/ql/lib/upgrades/4bd57e093275e5e892dfb16b55ed4bd76ea662be/upgrade.properties new file mode 100644 index 000000000000..e4cdd2164e44 --- /dev/null +++ b/go/ql/lib/upgrades/4bd57e093275e5e892dfb16b55ed4bd76ea662be/upgrade.properties @@ -0,0 +1,2 @@ +description: Add support for type aliases +compatibility: full diff --git a/go/ql/lib/upgrades/90fa7836e0a239f69bbebffcf342e92c240d54bc/go.dbscheme.stats b/go/ql/lib/upgrades/90fa7836e0a239f69bbebffcf342e92c240d54bc/go.dbscheme.stats new file mode 100644 index 000000000000..b18e8556fb24 --- /dev/null +++ b/go/ql/lib/upgrades/90fa7836e0a239f69bbebffcf342e92c240d54bc/go.dbscheme.stats @@ -0,0 +1,15183 @@ + + + + @similarity + 0 + + + @duplication + 0 + + + @xmldtd + 0 + + + @xmlelement + 504 + + + @xmlattribute + 408 + + + @externalDataElement + 0 + + + @xmlnamespace + 0 + + + @xmlcomment + 30 + + + @xmlcharacters + 869 + + + @compilation + 1 + + + @diagnostic + 0 + + + @file + 529 + + + @folder + 210 + + + @comment_group + 12083 + + + @slashslashcomment + 24878 + + + @slashstarcomment + 846 + + + @ident + 237316 + + + @ellipsis + 141 + + + @intlit + 7683 + + + @floatlit + 27 + + + @charlit + 838 + + + @stringlit + 24892 + + + @funclit + 678 + + + @compositelit + 2704 + + + @parenexpr + 343 + + + @selectorexpr + 54353 + + + @indexexpr + 4581 + + + @sliceexpr + 836 + + + @typeassertexpr + 2127 + + + @callorconversionexpr + 32041 + + + @starexpr + 10360 + + + @keyvalueexpr + 5616 + + + @arraytypeexpr + 3465 + + + @structtypeexpr + 1207 + + + @functypeexpr + 6015 + + + @interfacetypeexpr + 509 + + + @maptypeexpr + 1013 + + + @minusexpr + 270 + + + @notexpr + 1190 + + + @complementexpr + 21 + + + @addressexpr + 1739 + + + @arrowexpr + 92 + + + @lorexpr + 612 + + + @landexpr + 1234 + + + @eqlexpr + 3244 + + + @neqexpr + 4103 + + + @lssexpr + 785 + + + @leqexpr + 248 + + + @gtrexpr + 619 + + + @geqexpr + 270 + + + @addexpr + 1272 + + + @subexpr + 557 + + + @orexpr + 146 + + + @xorexpr + 14 + + + @mulexpr + 207 + + + @quoexpr + 53 + + + @remexpr + 24 + + + @shlexpr + 164 + + + @shrexpr + 57 + + + @andexpr + 235 + + + @andnotexpr + 19 + + + @sendchantypeexpr + 7 + + + @recvchantypeexpr + 9 + + + @sendrcvchantypeexpr + 101 + + + @badexpr + 0 + + + @imaglit + 0 + + + @plusexpr + 0 + + + @derefexpr + 0 + + + @field + 19974 + + + @location_default + 539178 + + + @declstmt + 1454 + + + @labeledstmt + 49 + + + @exprstmt + 7605 + + + @sendstmt + 69 + + + @incstmt + 614 + + + @decstmt + 71 + + + @gostmt + 72 + + + @deferstmt + 358 + + + @returnstmt + 9225 + + + @breakstmt + 301 + + + @continuestmt + 606 + + + @gotostmt + 8 + + + @fallthroughstmt + 7 + + + @blockstmt + 19358 + + + @ifstmt + 9728 + + + @caseclause + 3476 + + + @exprswitchstmt + 378 + + + @typeswitchstmt + 400 + + + @commclause + 72 + + + @selectstmt + 35 + + + @forstmt + 654 + + + @rangestmt + 2135 + + + @assignstmt + 7478 + + + @definestmt + 9514 + + + @addassignstmt + 223 + + + @subassignstmt + 18 + + + @mulassignstmt + 5 + + + @quoassignstmt + 3 + + + @orassignstmt + 63 + + + @xorassignstmt + 3 + + + @shlassignstmt + 2 + + + @shrassignstmt + 3 + + + @andnotassignstmt + 3 + + + @badstmt + 0 + + + @emptystmt + 0 + + + @remassignstmt + 0 + + + @andassignstmt + 0 + + + @importdecl + 479 + + + @constdecl + 280 + + + @typedecl + 1349 + + + @vardecl + 1769 + + + @funcdecl + 4813 + + + @baddecl + 0 + + + @importspec + 3468 + + + @valuespec + 3056 + + + @typedefspec + 1349 + + + @aliasspec + 16 + + + @universescope + 1 + + + @packagescope + 346 + + + @localscope + 36428 + + + @pkgobject + 3468 + + + @decltypeobject + 3602 + + + @builtintypeobject + 20 + + + @declconstobject + 8857 + + + @builtinconstobject + 4 + + + @declvarobject + 51098 + + + @declfunctionobject + 17793 + + + @builtinfunctionobject + 18 + + + @labelobject + 49 + + + @invalidtype + 1 + + + @boolexprtype + 1 + + + @inttype + 1 + + + @int8type + 1 + + + @int16type + 1 + + + @int32type + 1 + + + @int64type + 1 + + + @uinttype + 1 + + + @uint8type + 1 + + + @uint16type + 1 + + + @uint32type + 1 + + + @uint64type + 1 + + + @uintptrtype + 1 + + + @float32type + 1 + + + @float64type + 1 + + + @complex64type + 1 + + + @complex128type + 1 + + + @stringexprtype + 1 + + + @unsafepointertype + 1 + + + @boolliteraltype + 1 + + + @intliteraltype + 1 + + + @runeliteraltype + 1 + + + @floatliteraltype + 1 + + + @stringliteraltype + 1 + + + @nilliteraltype + 1 + + + @arraytype + 293 + + + @slicetype + 637 + + + @structtype + 2409 + + + @pointertype + 1903 + + + @interfacetype + 247 + + + @tupletype + 559 + + + @signaturetype + 8010 + + + @maptype + 430 + + + @sendchantype + 13 + + + @recvchantype + 10 + + + @sendrcvchantype + 29 + + + @namedtype + 3567 + + + @complexliteraltype + 0 + + + @package + 346 + + + @modline + 6 + + + @modlineblock + 1 + + + @modlparen + 1 + + + @modrparen + 1 + + + @modcommentblock + 0 + + + @unknownerror + 0 + + + @listerror + 0 + + + @parseerror + 0 + + + @typeerror + 0 + + + + + duplicateCode + 0 + + + id + 0 + + + relativePath + 0 + + + equivClass + 0 + + + + + id + relativePath + + + 12 + + + 1 + 2 + 1 + + + + + + + id + equivClass + + + 12 + + + 1 + 2 + 1 + + + + + + + relativePath + id + + + 12 + + + + + + relativePath + equivClass + + + 12 + + + + + + equivClass + id + + + 12 + + + + + + equivClass + relativePath + + + 12 + + + + + + + + similarCode + 0 + + + id + 0 + + + relativePath + 0 + + + equivClass + 0 + + + + + id + relativePath + + + 12 + + + 1 + 2 + 1 + + + + + + + id + equivClass + + + 12 + + + 1 + 2 + 1 + + + + + + + relativePath + id + + + 12 + + + + + + relativePath + equivClass + + + 12 + + + + + + equivClass + id + + + 12 + + + + + + equivClass + relativePath + + + 12 + + + + + + + + tokens + 0 + + + id + 0 + + + offset + 0 + + + beginLine + 0 + + + beginColumn + 0 + + + endLine + 0 + + + endColumn + 0 + + + + + id + offset + + + 12 + + + + + + id + beginLine + + + 12 + + + + + + id + beginColumn + + + 12 + + + + + + id + endLine + + + 12 + + + + + + id + endColumn + + + 12 + + + + + + offset + id + + + 12 + + + + + + offset + beginLine + + + 12 + + + + + + offset + beginColumn + + + 12 + + + + + + offset + endLine + + + 12 + + + + + + offset + endColumn + + + 12 + + + + + + beginLine + id + + + 12 + + + + + + beginLine + offset + + + 12 + + + + + + beginLine + beginColumn + + + 12 + + + + + + beginLine + endLine + + + 12 + + + + + + beginLine + endColumn + + + 12 + + + + + + beginColumn + id + + + 12 + + + + + + beginColumn + offset + + + 12 + + + + + + beginColumn + beginLine + + + 12 + + + + + + beginColumn + endLine + + + 12 + + + + + + beginColumn + endColumn + + + 12 + + + + + + endLine + id + + + 12 + + + + + + endLine + offset + + + 12 + + + + + + endLine + beginLine + + + 12 + + + + + + endLine + beginColumn + + + 12 + + + + + + endLine + endColumn + + + 12 + + + + + + endColumn + id + + + 12 + + + + + + endColumn + offset + + + 12 + + + + + + endColumn + beginLine + + + 12 + + + + + + endColumn + beginColumn + + + 12 + + + + + + endColumn + endLine + + + 12 + + + + + + + + externalData + 0 + + + id + 0 + + + path + 0 + + + column + 0 + + + value + 0 + + + + + id + path + + + 12 + + + + + + id + column + + + 12 + + + + + + id + value + + + 12 + + + + + + path + id + + + 12 + + + + + + path + column + + + 12 + + + + + + path + value + + + 12 + + + + + + column + id + + + 12 + + + + + + column + path + + + 12 + + + + + + column + value + + + 12 + + + + + + value + id + + + 12 + + + + + + value + path + + + 12 + + + + + + value + column + + + 12 + + + + + + + + snapshotDate + 0 + + + snapshotDate + 0 + + + + + + sourceLocationPrefix + 1 + + + prefix + 1 + + + + + + xmlEncoding + 0 + + + id + 0 + + + encoding + 0 + + + + + id + encoding + + + 12 + + + 1 + 2 + 1 + + + + + + + encoding + id + + + 12 + + + + + + + + xmlDTDs + 0 + + + id + 0 + + + root + 0 + + + publicId + 0 + + + systemId + 0 + + + fileid + 0 + + + + + id + root + + + 12 + + + 1 + 2 + 1 + + + + + + + id + publicId + + + 12 + + + 1 + 2 + 1 + + + + + + + id + systemId + + + 12 + + + 1 + 2 + 1 + + + + + + + id + fileid + + + 12 + + + 1 + 2 + 1 + + + + + + + root + id + + + 12 + + + + + + root + publicId + + + 12 + + + + + + root + systemId + + + 12 + + + + + + root + fileid + + + 12 + + + + + + publicId + id + + + 12 + + + + + + publicId + root + + + 12 + + + + + + publicId + systemId + + + 12 + + + + + + publicId + fileid + + + 12 + + + + + + systemId + id + + + 12 + + + + + + systemId + root + + + 12 + + + + + + systemId + publicId + + + 12 + + + + + + systemId + fileid + + + 12 + + + + + + fileid + id + + + 12 + + + + + + fileid + root + + + 12 + + + + + + fileid + publicId + + + 12 + + + + + + fileid + systemId + + + 12 + + + + + + + + xmlElements + 504 + + + id + 504 + + + name + 38 + + + parentid + 199 + + + idx + 86 + + + fileid + 14 + + + + + id + name + + + 12 + + + 1 + 2 + 504 + + + + + + + id + parentid + + + 12 + + + 1 + 2 + 504 + + + + + + + id + idx + + + 12 + + + 1 + 2 + 504 + + + + + + + id + fileid + + + 12 + + + 1 + 2 + 504 + + + + + + + name + id + + + 12 + + + 1 + 2 + 11 + + + 2 + 3 + 3 + + + 3 + 4 + 4 + + + 4 + 6 + 3 + + + 7 + 12 + 3 + + + 12 + 14 + 2 + + + 14 + 16 + 3 + + + 16 + 22 + 3 + + + 27 + 40 + 3 + + + 55 + 101 + 3 + + + + + + + name + parentid + + + 12 + + + 1 + 2 + 15 + + + 2 + 3 + 4 + + + 3 + 4 + 4 + + + 4 + 5 + 3 + + + 5 + 6 + 1 + + + 6 + 7 + 3 + + + 7 + 18 + 3 + + + 18 + 22 + 3 + + + 29 + 76 + 2 + + + + + + + name + idx + + + 12 + + + 1 + 2 + 12 + + + 2 + 3 + 4 + + + 3 + 4 + 5 + + + 4 + 5 + 1 + + + 5 + 6 + 3 + + + 6 + 9 + 3 + + + 10 + 11 + 2 + + + 13 + 15 + 3 + + + 15 + 17 + 3 + + + 17 + 41 + 2 + + + + + + + name + fileid + + + 12 + + + 1 + 2 + 18 + + + 2 + 3 + 7 + + + 3 + 4 + 3 + + + 4 + 5 + 1 + + + 5 + 6 + 4 + + + 7 + 11 + 3 + + + 11 + 14 + 2 + + + + + + + parentid + id + + + 12 + + + 1 + 2 + 116 + + + 2 + 3 + 37 + + + 3 + 4 + 22 + + + 4 + 8 + 15 + + + 8 + 61 + 9 + + + + + + + parentid + name + + + 12 + + + 1 + 2 + 160 + + + 2 + 3 + 23 + + + 3 + 8 + 16 + + + + + + + parentid + idx + + + 12 + + + 1 + 2 + 116 + + + 2 + 3 + 37 + + + 3 + 4 + 22 + + + 4 + 8 + 15 + + + 8 + 61 + 9 + + + + + + + parentid + fileid + + + 12 + + + 1 + 2 + 199 + + + + + + + idx + id + + + 12 + + + 1 + 2 + 54 + + + 2 + 3 + 4 + + + 3 + 4 + 11 + + + 4 + 6 + 6 + + + 6 + 21 + 7 + + + 40 + 141 + 4 + + + + + + + idx + name + + + 12 + + + 1 + 2 + 54 + + + 2 + 3 + 5 + + + 3 + 4 + 11 + + + 4 + 5 + 6 + + + 5 + 12 + 7 + + + 14 + 26 + 3 + + + + + + + idx + parentid + + + 12 + + + 1 + 2 + 54 + + + 2 + 3 + 4 + + + 3 + 4 + 11 + + + 4 + 6 + 6 + + + 6 + 21 + 7 + + + 40 + 141 + 4 + + + + + + + idx + fileid + + + 12 + + + 1 + 2 + 54 + + + 2 + 3 + 4 + + + 3 + 4 + 11 + + + 4 + 5 + 8 + + + 5 + 13 + 7 + + + 13 + 15 + 2 + + + + + + + fileid + id + + + 12 + + + 2 + 3 + 1 + + + 7 + 8 + 1 + + + 8 + 9 + 2 + + + 10 + 11 + 1 + + + 16 + 17 + 1 + + + 18 + 19 + 1 + + + 20 + 21 + 1 + + + 21 + 22 + 2 + + + 58 + 59 + 1 + + + 100 + 101 + 1 + + + 107 + 108 + 1 + + + 108 + 109 + 1 + + + + + + + fileid + name + + + 12 + + + 2 + 3 + 1 + + + 3 + 4 + 2 + + + 4 + 5 + 1 + + + 5 + 6 + 2 + + + 6 + 7 + 2 + + + 8 + 9 + 2 + + + 11 + 12 + 1 + + + 16 + 17 + 1 + + + 17 + 18 + 1 + + + 19 + 20 + 1 + + + + + + + fileid + parentid + + + 12 + + + 2 + 3 + 2 + + + 4 + 5 + 1 + + + 6 + 7 + 2 + + + 7 + 8 + 3 + + + 9 + 10 + 1 + + + 10 + 11 + 1 + + + 20 + 21 + 1 + + + 23 + 24 + 1 + + + 47 + 48 + 1 + + + 49 + 50 + 1 + + + + + + + fileid + idx + + + 12 + + + 1 + 2 + 1 + + + 3 + 4 + 2 + + + 4 + 5 + 1 + + + 7 + 8 + 3 + + + 8 + 9 + 1 + + + 13 + 14 + 1 + + + 14 + 15 + 1 + + + 16 + 17 + 1 + + + 30 + 31 + 1 + + + 34 + 35 + 1 + + + 67 + 68 + 1 + + + + + + + + + xmlAttrs + 408 + + + id + 408 + + + elementid + 288 + + + name + 28 + + + value + 235 + + + idx + 6 + + + fileid + 14 + + + + + id + elementid + + + 12 + + + 1 + 2 + 408 + + + + + + + id + name + + + 12 + + + 1 + 2 + 408 + + + + + + + id + value + + + 12 + + + 1 + 2 + 408 + + + + + + + id + idx + + + 12 + + + 1 + 2 + 408 + + + + + + + id + fileid + + + 12 + + + 1 + 2 + 408 + + + + + + + elementid + id + + + 12 + + + 1 + 2 + 195 + + + 2 + 3 + 69 + + + 3 + 4 + 23 + + + 6 + 7 + 1 + + + + + + + elementid + name + + + 12 + + + 1 + 2 + 195 + + + 2 + 3 + 69 + + + 3 + 4 + 23 + + + 6 + 7 + 1 + + + + + + + elementid + value + + + 12 + + + 1 + 2 + 195 + + + 2 + 3 + 70 + + + 3 + 4 + 22 + + + 4 + 5 + 1 + + + + + + + elementid + idx + + + 12 + + + 1 + 2 + 195 + + + 2 + 3 + 69 + + + 3 + 4 + 23 + + + 6 + 7 + 1 + + + + + + + elementid + fileid + + + 12 + + + 1 + 2 + 288 + + + + + + + name + id + + + 12 + + + 1 + 2 + 12 + + + 2 + 3 + 3 + + + 3 + 4 + 4 + + + 5 + 15 + 2 + + + 21 + 22 + 2 + + + 22 + 23 + 2 + + + 45 + 97 + 2 + + + 132 + 133 + 1 + + + + + + + name + elementid + + + 12 + + + 1 + 2 + 12 + + + 2 + 3 + 3 + + + 3 + 4 + 4 + + + 5 + 15 + 2 + + + 21 + 22 + 2 + + + 22 + 23 + 2 + + + 45 + 97 + 2 + + + 132 + 133 + 1 + + + + + + + name + value + + + 12 + + + 1 + 2 + 16 + + + 2 + 3 + 2 + + + 3 + 4 + 3 + + + 11 + 12 + 1 + + + 15 + 16 + 2 + + + 21 + 36 + 2 + + + 41 + 75 + 2 + + + + + + + name + idx + + + 12 + + + 1 + 2 + 19 + + + 2 + 3 + 5 + + + 3 + 4 + 4 + + + + + + + name + fileid + + + 12 + + + 1 + 2 + 18 + + + 2 + 3 + 2 + + + 3 + 4 + 2 + + + 4 + 6 + 2 + + + 10 + 11 + 3 + + + 13 + 14 + 1 + + + + + + + value + id + + + 12 + + + 1 + 2 + 171 + + + 2 + 3 + 32 + + + 3 + 5 + 18 + + + 5 + 13 + 14 + + + + + + + value + elementid + + + 12 + + + 1 + 2 + 174 + + + 2 + 3 + 29 + + + 3 + 5 + 18 + + + 5 + 13 + 14 + + + + + + + value + name + + + 12 + + + 1 + 2 + 230 + + + 2 + 4 + 5 + + + + + + + value + idx + + + 12 + + + 1 + 2 + 224 + + + 2 + 4 + 11 + + + + + + + value + fileid + + + 12 + + + 1 + 2 + 193 + + + 2 + 3 + 32 + + + 3 + 7 + 10 + + + + + + + idx + id + + + 12 + + + 1 + 2 + 3 + + + 24 + 25 + 1 + + + 93 + 94 + 1 + + + 288 + 289 + 1 + + + + + + + idx + elementid + + + 12 + + + 1 + 2 + 3 + + + 24 + 25 + 1 + + + 93 + 94 + 1 + + + 288 + 289 + 1 + + + + + + + idx + name + + + 12 + + + 1 + 2 + 3 + + + 8 + 9 + 1 + + + 14 + 15 + 1 + + + 16 + 17 + 1 + + + + + + + idx + value + + + 12 + + + 1 + 2 + 3 + + + 23 + 24 + 1 + + + 64 + 65 + 1 + + + 157 + 158 + 1 + + + + + + + idx + fileid + + + 12 + + + 1 + 2 + 3 + + + 6 + 7 + 1 + + + 12 + 13 + 1 + + + 14 + 15 + 1 + + + + + + + fileid + id + + + 12 + + + 2 + 3 + 1 + + + 4 + 5 + 1 + + + 10 + 11 + 2 + + + 11 + 12 + 1 + + + 12 + 13 + 1 + + + 17 + 18 + 1 + + + 18 + 19 + 1 + + + 19 + 20 + 1 + + + 22 + 23 + 1 + + + 48 + 49 + 1 + + + 73 + 74 + 2 + + + 89 + 90 + 1 + + + + + + + fileid + elementid + + + 12 + + + 1 + 2 + 1 + + + 4 + 5 + 1 + + + 8 + 9 + 2 + + + 9 + 10 + 1 + + + 11 + 12 + 1 + + + 12 + 13 + 2 + + + 16 + 17 + 1 + + + 17 + 18 + 1 + + + 18 + 19 + 1 + + + 42 + 43 + 1 + + + 63 + 64 + 1 + + + 67 + 68 + 1 + + + + + + + fileid + name + + + 12 + + + 2 + 3 + 2 + + + 3 + 4 + 2 + + + 4 + 5 + 4 + + + 5 + 6 + 1 + + + 6 + 7 + 2 + + + 7 + 8 + 2 + + + 23 + 24 + 1 + + + + + + + fileid + value + + + 12 + + + 2 + 3 + 1 + + + 3 + 4 + 1 + + + 6 + 7 + 1 + + + 8 + 9 + 2 + + + 9 + 10 + 1 + + + 10 + 11 + 1 + + + 13 + 14 + 1 + + + 14 + 15 + 1 + + + 18 + 19 + 1 + + + 32 + 33 + 1 + + + 54 + 55 + 1 + + + 60 + 61 + 1 + + + 61 + 62 + 1 + + + + + + + fileid + idx + + + 12 + + + 1 + 2 + 2 + + + 2 + 3 + 6 + + + 3 + 4 + 5 + + + 6 + 7 + 1 + + + + + + + + + xmlNs + 0 + + + id + 0 + + + prefixName + 0 + + + URI + 0 + + + fileid + 0 + + + + + id + prefixName + + + 12 + + + + + + id + URI + + + 12 + + + + + + id + fileid + + + 12 + + + + + + prefixName + id + + + 12 + + + + + + prefixName + URI + + + 12 + + + + + + prefixName + fileid + + + 12 + + + + + + URI + id + + + 12 + + + + + + URI + prefixName + + + 12 + + + + + + URI + fileid + + + 12 + + + + + + fileid + id + + + 12 + + + + + + fileid + prefixName + + + 12 + + + + + + fileid + URI + + + 12 + + + + + + + + xmlHasNs + 0 + + + elementId + 0 + + + nsId + 0 + + + fileid + 0 + + + + + elementId + nsId + + + 12 + + + + + + elementId + fileid + + + 12 + + + + + + nsId + elementId + + + 12 + + + + + + nsId + fileid + + + 12 + + + + + + fileid + elementId + + + 12 + + + + + + fileid + nsId + + + 12 + + + + + + + + xmlComments + 30 + + + id + 30 + + + text + 18 + + + parentid + 20 + + + fileid + 10 + + + + + id + text + + + 12 + + + 1 + 2 + 30 + + + + + + + id + parentid + + + 12 + + + 1 + 2 + 30 + + + + + + + id + fileid + + + 12 + + + 1 + 2 + 30 + + + + + + + text + id + + + 12 + + + 1 + 2 + 13 + + + 2 + 3 + 3 + + + 4 + 5 + 1 + + + 7 + 8 + 1 + + + + + + + text + parentid + + + 12 + + + 1 + 2 + 14 + + + 2 + 3 + 2 + + + 4 + 5 + 1 + + + 7 + 8 + 1 + + + + + + + text + fileid + + + 12 + + + 1 + 2 + 15 + + + 2 + 3 + 2 + + + 7 + 8 + 1 + + + + + + + parentid + id + + + 12 + + + 1 + 2 + 15 + + + 2 + 3 + 3 + + + 4 + 5 + 1 + + + 5 + 6 + 1 + + + + + + + parentid + text + + + 12 + + + 1 + 2 + 15 + + + 2 + 3 + 3 + + + 3 + 4 + 1 + + + 5 + 6 + 1 + + + + + + + parentid + fileid + + + 12 + + + 1 + 2 + 20 + + + + + + + fileid + id + + + 12 + + + 1 + 2 + 6 + + + 2 + 3 + 1 + + + 4 + 5 + 1 + + + 8 + 9 + 1 + + + 10 + 11 + 1 + + + + + + + fileid + text + + + 12 + + + 1 + 2 + 6 + + + 2 + 3 + 1 + + + 4 + 5 + 1 + + + 5 + 6 + 1 + + + 9 + 10 + 1 + + + + + + + fileid + parentid + + + 12 + + + 1 + 2 + 7 + + + 3 + 4 + 1 + + + 5 + 6 + 2 + + + + + + + + + xmlChars + 869 + + + id + 869 + + + text + 427 + + + parentid + 432 + + + idx + 87 + + + isCDATA + 1 + + + fileid + 14 + + + + + id + text + + + 12 + + + 1 + 2 + 869 + + + + + + + id + parentid + + + 12 + + + 1 + 2 + 869 + + + + + + + id + idx + + + 12 + + + 1 + 2 + 869 + + + + + + + id + isCDATA + + + 12 + + + 1 + 2 + 869 + + + + + + + id + fileid + + + 12 + + + 1 + 2 + 869 + + + + + + + text + id + + + 12 + + + 1 + 2 + 339 + + + 2 + 3 + 53 + + + 3 + 49 + 33 + + + 68 + 90 + 2 + + + + + + + text + parentid + + + 12 + + + 1 + 2 + 342 + + + 2 + 3 + 50 + + + 3 + 28 + 33 + + + 28 + 32 + 2 + + + + + + + text + idx + + + 12 + + + 1 + 2 + 400 + + + 2 + 58 + 27 + + + + + + + text + isCDATA + + + 12 + + + 1 + 2 + 427 + + + + + + + text + fileid + + + 12 + + + 1 + 2 + 380 + + + 2 + 4 + 36 + + + 4 + 11 + 11 + + + + + + + parentid + id + + + 12 + + + 1 + 2 + 302 + + + 2 + 3 + 53 + + + 3 + 4 + 28 + + + 4 + 7 + 34 + + + 7 + 60 + 15 + + + + + + + parentid + text + + + 12 + + + 1 + 2 + 314 + + + 2 + 3 + 67 + + + 3 + 5 + 37 + + + 5 + 26 + 14 + + + + + + + parentid + idx + + + 12 + + + 1 + 2 + 302 + + + 2 + 3 + 53 + + + 3 + 4 + 28 + + + 4 + 7 + 34 + + + 7 + 60 + 15 + + + + + + + parentid + isCDATA + + + 12 + + + 1 + 2 + 432 + + + + + + + parentid + fileid + + + 12 + + + 1 + 2 + 432 + + + + + + + idx + id + + + 12 + + + 1 + 2 + 55 + + + 2 + 3 + 3 + + + 3 + 4 + 11 + + + 4 + 7 + 7 + + + 8 + 28 + 7 + + + 41 + 408 + 4 + + + + + + + idx + text + + + 12 + + + 1 + 2 + 55 + + + 2 + 3 + 3 + + + 3 + 4 + 12 + + + 4 + 7 + 7 + + + 7 + 28 + 7 + + + 44 + 251 + 3 + + + + + + + idx + parentid + + + 12 + + + 1 + 2 + 55 + + + 2 + 3 + 3 + + + 3 + 4 + 11 + + + 4 + 7 + 7 + + + 8 + 28 + 7 + + + 41 + 408 + 4 + + + + + + + idx + isCDATA + + + 12 + + + 1 + 2 + 87 + + + + + + + idx + fileid + + + 12 + + + 1 + 2 + 55 + + + 2 + 3 + 3 + + + 3 + 4 + 12 + + + 4 + 5 + 7 + + + 5 + 12 + 7 + + + 13 + 15 + 3 + + + + + + + isCDATA + id + + + 12 + + + 869 + 870 + 1 + + + + + + + isCDATA + text + + + 12 + + + 427 + 428 + 1 + + + + + + + isCDATA + parentid + + + 12 + + + 432 + 433 + 1 + + + + + + + isCDATA + idx + + + 12 + + + 87 + 88 + 1 + + + + + + + isCDATA + fileid + + + 12 + + + 14 + 15 + 1 + + + + + + + fileid + id + + + 12 + + + 5 + 6 + 1 + + + 13 + 14 + 1 + + + 14 + 15 + 2 + + + 17 + 18 + 1 + + + 28 + 29 + 1 + + + 30 + 31 + 1 + + + 34 + 35 + 1 + + + 35 + 36 + 1 + + + 36 + 37 + 1 + + + 80 + 81 + 1 + + + 177 + 178 + 1 + + + 191 + 192 + 1 + + + 195 + 196 + 1 + + + + + + + fileid + text + + + 12 + + + 3 + 4 + 1 + + + 7 + 8 + 2 + + + 9 + 10 + 1 + + + 13 + 14 + 1 + + + 15 + 16 + 1 + + + 18 + 19 + 1 + + + 24 + 25 + 1 + + + 25 + 26 + 1 + + + 26 + 27 + 1 + + + 49 + 50 + 1 + + + 100 + 101 + 1 + + + 105 + 106 + 1 + + + 118 + 119 + 1 + + + + + + + fileid + parentid + + + 12 + + + 3 + 4 + 1 + + + 7 + 8 + 1 + + + 9 + 10 + 2 + + + 10 + 11 + 1 + + + 14 + 15 + 1 + + + 15 + 16 + 2 + + + 18 + 19 + 1 + + + 20 + 21 + 1 + + + 33 + 34 + 1 + + + 88 + 89 + 1 + + + 95 + 96 + 1 + + + 96 + 97 + 1 + + + + + + + fileid + idx + + + 12 + + + 2 + 3 + 1 + + + 4 + 5 + 2 + + + 5 + 6 + 1 + + + 7 + 8 + 3 + + + 9 + 10 + 1 + + + 13 + 14 + 1 + + + 15 + 16 + 2 + + + 32 + 33 + 1 + + + 35 + 36 + 1 + + + 65 + 66 + 1 + + + + + + + fileid + isCDATA + + + 12 + + + 1 + 2 + 14 + + + + + + + + + xmllocations + 1825 + + + xmlElement + 1825 + + + location + 1825 + + + + + xmlElement + location + + + 12 + + + 1 + 2 + 1825 + + + + + + + location + xmlElement + + + 12 + + + 1 + 2 + 1825 + + + + + + + + + compilations + 1 + + + id + 1 + + + cwd + 1 + + + + + id + cwd + + + 12 + + + 1 + 2 + 1 + + + + + + + cwd + id + + + 12 + + + 1 + 2 + 1 + + + + + + + + + compilation_args + 3 + + + id + 1 + + + num + 3 + + + arg + 3 + + + + + id + num + + + 12 + + + 3 + 4 + 1 + + + + + + + id + arg + + + 12 + + + 3 + 4 + 1 + + + + + + + num + id + + + 12 + + + 1 + 2 + 3 + + + + + + + num + arg + + + 12 + + + 1 + 2 + 3 + + + + + + + arg + id + + + 12 + + + 1 + 2 + 3 + + + + + + + arg + num + + + 12 + + + 1 + 2 + 3 + + + + + + + + + compilation_time + 0 + + + id + 0 + + + num + 0 + + + kind + 0 + + + secs + 0 + + + + + id + num + + + 12 + + + + + + id + kind + + + 12 + + + + + + id + secs + + + 12 + + + + + + num + id + + + 12 + + + + + + num + kind + + + 12 + + + + + + num + secs + + + 12 + + + + + + kind + id + + + 12 + + + + + + kind + num + + + 12 + + + + + + kind + secs + + + 12 + + + + + + secs + id + + + 12 + + + + + + secs + num + + + 12 + + + + + + secs + kind + + + 12 + + + + + + + + diagnostic_for + 0 + + + diagnostic + 0 + + + compilation + 0 + + + file_number + 0 + + + file_number_diagnostic_number + 0 + + + + + diagnostic + compilation + + + 12 + + + 1 + 2 + 1 + + + + + + + diagnostic + file_number + + + 12 + + + 1 + 2 + 1 + + + + + + + diagnostic + file_number_diagnostic_number + + + 12 + + + 1 + 2 + 1 + + + + + + + compilation + diagnostic + + + 12 + + + + + + compilation + file_number + + + 12 + + + + + + compilation + file_number_diagnostic_number + + + 12 + + + + + + file_number + diagnostic + + + 12 + + + + + + file_number + compilation + + + 12 + + + + + + file_number + file_number_diagnostic_number + + + 12 + + + + + + file_number_diagnostic_number + diagnostic + + + 12 + + + + + + file_number_diagnostic_number + compilation + + + 12 + + + + + + file_number_diagnostic_number + file_number + + + 12 + + + + + + + + compilation_finished + 1 + + + id + 1 + + + cpu_seconds + 1 + + + elapsed_seconds + 1 + + + + + id + cpu_seconds + + + 12 + + + 1 + 2 + 1 + + + + + + + id + elapsed_seconds + + + 12 + + + 1 + 2 + 1 + + + + + + + cpu_seconds + id + + + 12 + + + 1 + 2 + 1 + + + + + + + cpu_seconds + elapsed_seconds + + + 12 + + + 1 + 2 + 1 + + + + + + + elapsed_seconds + id + + + 12 + + + 1 + 2 + 1 + + + + + + + elapsed_seconds + cpu_seconds + + + 12 + + + 1 + 2 + 1 + + + + + + + + + compilation_compiling_files + 515 + + + id + 1 + + + num + 515 + + + file + 515 + + + + + id + num + + + 12 + + + 515 + 516 + 1 + + + + + + + id + file + + + 12 + + + 515 + 516 + 1 + + + + + + + num + id + + + 12 + + + 1 + 2 + 515 + + + + + + + num + file + + + 12 + + + 1 + 2 + 515 + + + + + + + file + id + + + 12 + + + 1 + 2 + 515 + + + + + + + file + num + + + 12 + + + 1 + 2 + 515 + + + + + + + + + diagnostics + 0 + + + id + 0 + + + severity + 0 + + + error_tag + 0 + + + error_message + 0 + + + full_error_message + 0 + + + location + 0 + + + + + id + severity + + + 12 + + + 1 + 2 + 1 + + + + + + + id + error_tag + + + 12 + + + 1 + 2 + 1 + + + + + + + id + error_message + + + 12 + + + 1 + 2 + 1 + + + + + + + id + full_error_message + + + 12 + + + 1 + 2 + 1 + + + + + + + id + location + + + 12 + + + 1 + 2 + 1 + + + + + + + severity + id + + + 12 + + + + + + severity + error_tag + + + 12 + + + + + + severity + error_message + + + 12 + + + + + + severity + full_error_message + + + 12 + + + + + + severity + location + + + 12 + + + + + + error_tag + id + + + 12 + + + + + + error_tag + severity + + + 12 + + + + + + error_tag + error_message + + + 12 + + + + + + error_tag + full_error_message + + + 12 + + + + + + error_tag + location + + + 12 + + + + + + error_message + id + + + 12 + + + + + + error_message + severity + + + 12 + + + + + + error_message + error_tag + + + 12 + + + + + + error_message + full_error_message + + + 12 + + + + + + error_message + location + + + 12 + + + + + + full_error_message + id + + + 12 + + + + + + full_error_message + severity + + + 12 + + + + + + full_error_message + error_tag + + + 12 + + + + + + full_error_message + error_message + + + 12 + + + + + + full_error_message + location + + + 12 + + + + + + location + id + + + 12 + + + + + + location + severity + + + 12 + + + + + + location + error_tag + + + 12 + + + + + + location + error_message + + + 12 + + + + + + location + full_error_message + + + 12 + + + + + + + + locations_default + 539178 + + + id + 539178 + + + file + 529 + + + beginLine + 10312 + + + beginColumn + 211 + + + endLine + 10378 + + + endColumn + 274 + + + + + id + file + + + 12 + + + 1 + 2 + 539178 + + + + + + + id + beginLine + + + 12 + + + 1 + 2 + 539178 + + + + + + + id + beginColumn + + + 12 + + + 1 + 2 + 539178 + + + + + + + id + endLine + + + 12 + + + 1 + 2 + 539178 + + + + + + + id + endColumn + + + 12 + + + 1 + 2 + 539178 + + + + + + + file + id + + + 12 + + + 4 + 39 + 41 + + + 39 + 120 + 40 + + + 120 + 208 + 40 + + + 210 + 290 + 40 + + + 291 + 372 + 40 + + + 372 + 453 + 41 + + + 456 + 563 + 40 + + + 565 + 769 + 40 + + + 774 + 1007 + 40 + + + 1012 + 1339 + 42 + + + 1347 + 1700 + 40 + + + 1701 + 2804 + 40 + + + 2873 + 6918 + 40 + + + 8171 + 11207 + 5 + + + + + + + file + beginLine + + + 12 + + + 3 + 15 + 44 + + + 15 + 27 + 42 + + + 27 + 46 + 40 + + + 46 + 63 + 43 + + + 63 + 78 + 40 + + + 78 + 94 + 41 + + + 95 + 120 + 40 + + + 120 + 152 + 41 + + + 152 + 188 + 40 + + + 189 + 247 + 41 + + + 249 + 325 + 40 + + + 336 + 544 + 40 + + + 554 + 10233 + 37 + + + + + + + file + beginColumn + + + 12 + + + 3 + 16 + 40 + + + 16 + 34 + 40 + + + 34 + 44 + 40 + + + 45 + 51 + 44 + + + 51 + 58 + 41 + + + 58 + 63 + 47 + + + 63 + 68 + 44 + + + 68 + 73 + 43 + + + 73 + 80 + 47 + + + 80 + 86 + 43 + + + 86 + 98 + 42 + + + 98 + 115 + 42 + + + 115 + 157 + 16 + + + + + + + file + endLine + + + 12 + + + 3 + 16 + 41 + + + 16 + 31 + 40 + + + 31 + 52 + 40 + + + 52 + 73 + 43 + + + 73 + 92 + 42 + + + 92 + 111 + 40 + + + 111 + 139 + 40 + + + 139 + 180 + 40 + + + 180 + 219 + 40 + + + 223 + 293 + 40 + + + 294 + 370 + 40 + + + 373 + 616 + 40 + + + 617 + 1835 + 40 + + + 2166 + 10377 + 3 + + + + + + + file + endColumn + + + 12 + + + 4 + 21 + 42 + + + 22 + 45 + 41 + + + 46 + 59 + 43 + + + 59 + 65 + 40 + + + 65 + 71 + 42 + + + 71 + 76 + 47 + + + 76 + 81 + 40 + + + 81 + 85 + 48 + + + 85 + 91 + 41 + + + 91 + 97 + 42 + + + 97 + 105 + 41 + + + 105 + 119 + 42 + + + 119 + 166 + 20 + + + + + + + beginLine + id + + + 12 + + + 1 + 2 + 6869 + + + 2 + 7 + 843 + + + 7 + 20 + 796 + + + 20 + 80 + 780 + + + 80 + 698 + 774 + + + 699 + 1775 + 250 + + + + + + + beginLine + file + + + 12 + + + 1 + 2 + 6947 + + + 2 + 3 + 868 + + + 3 + 6 + 899 + + + 6 + 24 + 774 + + + 24 + 304 + 774 + + + 305 + 530 + 50 + + + + + + + beginLine + beginColumn + + + 12 + + + 1 + 2 + 6894 + + + 2 + 5 + 789 + + + 5 + 11 + 780 + + + 11 + 30 + 796 + + + 30 + 72 + 779 + + + 72 + 115 + 274 + + + + + + + beginLine + endLine + + + 12 + + + 1 + 2 + 7630 + + + 2 + 3 + 1017 + + + 3 + 6 + 779 + + + 6 + 21 + 792 + + + 21 + 315 + 94 + + + + + + + beginLine + endColumn + + + 12 + + + 1 + 2 + 6871 + + + 2 + 5 + 793 + + + 5 + 12 + 789 + + + 12 + 33 + 778 + + + 33 + 81 + 781 + + + 81 + 127 + 300 + + + + + + + beginColumn + id + + + 12 + + + 1 + 2 + 29 + + + 2 + 4 + 19 + + + 4 + 9 + 16 + + + 10 + 22 + 16 + + + 22 + 62 + 16 + + + 62 + 141 + 16 + + + 144 + 330 + 16 + + + 330 + 759 + 16 + + + 781 + 1804 + 16 + + + 1846 + 3757 + 16 + + + 4042 + 8613 + 16 + + + 8764 + 22092 + 16 + + + 28067 + 55590 + 3 + + + + + + + beginColumn + file + + + 12 + + + 1 + 2 + 36 + + + 2 + 4 + 14 + + + 4 + 10 + 18 + + + 10 + 22 + 17 + + + 22 + 48 + 17 + + + 49 + 96 + 17 + + + 96 + 180 + 16 + + + 180 + 292 + 16 + + + 297 + 382 + 16 + + + 383 + 430 + 16 + + + 431 + 463 + 16 + + + 463 + 530 + 12 + + + + + + + beginColumn + beginLine + + + 12 + + + 1 + 2 + 36 + + + 2 + 4 + 13 + + + 4 + 9 + 16 + + + 9 + 20 + 16 + + + 20 + 53 + 16 + + + 55 + 103 + 16 + + + 107 + 209 + 16 + + + 221 + 412 + 16 + + + 422 + 682 + 16 + + + 706 + 975 + 16 + + + 977 + 1410 + 16 + + + 1417 + 1983 + 16 + + + 2809 + 10184 + 2 + + + + + + + beginColumn + endLine + + + 12 + + + 1 + 2 + 36 + + + 2 + 4 + 13 + + + 4 + 9 + 16 + + + 9 + 21 + 19 + + + 24 + 55 + 16 + + + 58 + 128 + 16 + + + 131 + 226 + 16 + + + 231 + 453 + 16 + + + 480 + 769 + 16 + + + 783 + 1037 + 16 + + + 1057 + 1521 + 16 + + + 1526 + 10180 + 15 + + + + + + + beginColumn + endColumn + + + 12 + + + 1 + 2 + 31 + + + 2 + 3 + 16 + + + 3 + 6 + 17 + + + 6 + 12 + 17 + + + 12 + 21 + 16 + + + 21 + 28 + 16 + + + 28 + 35 + 17 + + + 35 + 45 + 16 + + + 46 + 56 + 16 + + + 56 + 77 + 17 + + + 77 + 101 + 17 + + + 101 + 201 + 15 + + + + + + + endLine + id + + + 12 + + + 1 + 2 + 6731 + + + 2 + 6 + 903 + + + 6 + 16 + 817 + + + 16 + 58 + 785 + + + 58 + 457 + 779 + + + 458 + 1734 + 363 + + + + + + + endLine + file + + + 12 + + + 1 + 2 + 6847 + + + 2 + 3 + 810 + + + 3 + 5 + 787 + + + 5 + 14 + 802 + + + 14 + 104 + 780 + + + 105 + 530 + 352 + + + + + + + endLine + beginLine + + + 12 + + + 1 + 2 + 7766 + + + 2 + 3 + 956 + + + 3 + 7 + 860 + + + 7 + 27 + 785 + + + 27 + 31 + 11 + + + + + + + endLine + beginColumn + + + 12 + + + 1 + 2 + 6749 + + + 2 + 4 + 616 + + + 4 + 8 + 878 + + + 8 + 21 + 799 + + + 21 + 53 + 779 + + + 53 + 113 + 557 + + + + + + + endLine + endColumn + + + 12 + + + 1 + 2 + 6792 + + + 2 + 5 + 936 + + + 5 + 12 + 801 + + + 12 + 34 + 791 + + + 34 + 83 + 787 + + + 83 + 127 + 271 + + + + + + + endColumn + id + + + 12 + + + 1 + 2 + 33 + + + 2 + 3 + 60 + + + 3 + 9 + 23 + + + 9 + 40 + 21 + + + 43 + 111 + 21 + + + 121 + 347 + 21 + + + 369 + 1229 + 21 + + + 1267 + 3311 + 21 + + + 3642 + 7560 + 21 + + + 7682 + 12716 + 21 + + + 12740 + 20483 + 11 + + + + + + + endColumn + file + + + 12 + + + 1 + 2 + 94 + + + 2 + 6 + 19 + + + 6 + 16 + 21 + + + 16 + 45 + 21 + + + 45 + 110 + 21 + + + 123 + 281 + 21 + + + 290 + 393 + 21 + + + 395 + 445 + 21 + + + 446 + 468 + 21 + + + 470 + 530 + 14 + + + + + + + endColumn + beginLine + + + 12 + + + 1 + 2 + 94 + + + 2 + 6 + 19 + + + 6 + 21 + 21 + + + 21 + 52 + 21 + + + 54 + 154 + 21 + + + 157 + 449 + 21 + + + 455 + 808 + 21 + + + 814 + 1132 + 21 + + + 1145 + 1769 + 21 + + + 1792 + 2365 + 14 + + + + + + + endColumn + beginColumn + + + 12 + + + 1 + 2 + 39 + + + 2 + 3 + 56 + + + 3 + 7 + 23 + + + 7 + 18 + 21 + + + 18 + 27 + 24 + + + 27 + 37 + 22 + + + 37 + 49 + 23 + + + 49 + 63 + 22 + + + 63 + 74 + 20 + + + 74 + 102 + 21 + + + 103 + 172 + 3 + + + + + + + endColumn + endLine + + + 12 + + + 1 + 2 + 94 + + + 2 + 6 + 19 + + + 6 + 21 + 21 + + + 21 + 52 + 21 + + + 53 + 153 + 21 + + + 156 + 444 + 21 + + + 446 + 789 + 21 + + + 806 + 1121 + 21 + + + 1138 + 1726 + 21 + + + 1787 + 2357 + 14 + + + + + + + + + numlines + 514 + + + element_id + 514 + + + num_lines + 309 + + + num_code + 350 + + + num_comment + 150 + + + + + element_id + num_lines + + + 12 + + + 1 + 2 + 514 + + + + + + + element_id + num_code + + + 12 + + + 1 + 2 + 514 + + + + + + + element_id + num_comment + + + 12 + + + 1 + 2 + 514 + + + + + + + num_lines + element_id + + + 12 + + + 1 + 2 + 183 + + + 2 + 3 + 74 + + + 3 + 4 + 32 + + + 4 + 7 + 20 + + + + + + + num_lines + num_code + + + 12 + + + 1 + 2 + 187 + + + 2 + 3 + 82 + + + 3 + 4 + 23 + + + 4 + 7 + 17 + + + + + + + num_lines + num_comment + + + 12 + + + 1 + 2 + 188 + + + 2 + 3 + 79 + + + 3 + 4 + 28 + + + 4 + 7 + 14 + + + + + + + num_code + element_id + + + 12 + + + 1 + 2 + 252 + + + 2 + 3 + 65 + + + 3 + 5 + 28 + + + 6 + 18 + 5 + + + + + + + num_code + num_lines + + + 12 + + + 1 + 2 + 256 + + + 2 + 3 + 67 + + + 3 + 18 + 27 + + + + + + + num_code + num_comment + + + 12 + + + 1 + 2 + 259 + + + 2 + 3 + 63 + + + 3 + 7 + 27 + + + 17 + 18 + 1 + + + + + + + num_comment + element_id + + + 12 + + + 1 + 2 + 65 + + + 2 + 3 + 27 + + + 3 + 4 + 17 + + + 4 + 5 + 7 + + + 5 + 6 + 10 + + + 6 + 10 + 12 + + + 10 + 31 + 12 + + + + + + + num_comment + num_lines + + + 12 + + + 1 + 2 + 65 + + + 2 + 3 + 27 + + + 3 + 4 + 18 + + + 4 + 5 + 7 + + + 5 + 6 + 10 + + + 6 + 10 + 13 + + + 10 + 25 + 10 + + + + + + + num_comment + num_code + + + 12 + + + 1 + 2 + 66 + + + 2 + 3 + 27 + + + 3 + 4 + 17 + + + 4 + 5 + 6 + + + 5 + 6 + 10 + + + 6 + 9 + 12 + + + 9 + 24 + 12 + + + + + + + + + files + 529 + + + id + 529 + + + name + 529 + + + + + id + name + + + 12 + + + 1 + 2 + 529 + + + + + + + name + id + + + 12 + + + 1 + 2 + 529 + + + + + + + + + folders + 210 + + + id + 210 + + + name + 210 + + + + + id + name + + + 12 + + + 1 + 2 + 210 + + + + + + + name + id + + + 12 + + + 1 + 2 + 210 + + + + + + + + + containerparent + 738 + + + parent + 210 + + + child + 738 + + + + + parent + child + + + 12 + + + 1 + 2 + 115 + + + 2 + 3 + 32 + + + 3 + 4 + 12 + + + 4 + 6 + 19 + + + 6 + 12 + 16 + + + 13 + 38 + 16 + + + + + + + child + parent + + + 12 + + + 1 + 2 + 738 + + + + + + + + + has_location + 599339 + + + locatable + 599339 + + + location + 537353 + + + + + locatable + location + + + 12 + + + 1 + 2 + 599339 + + + + + + + location + locatable + + + 12 + + + 1 + 2 + 475682 + + + 2 + 3 + 61627 + + + 3 + 75 + 44 + + + + + + + + + comment_groups + 12083 + + + id + 12083 + + + parent + 509 + + + idx + 720 + + + + + id + parent + + + 12 + + + 1 + 2 + 12083 + + + + + + + id + idx + + + 12 + + + 1 + 2 + 12083 + + + + + + + parent + id + + + 12 + + + 1 + 2 + 44 + + + 2 + 3 + 45 + + + 3 + 4 + 32 + + + 4 + 5 + 27 + + + 5 + 7 + 38 + + + 7 + 10 + 47 + + + 10 + 13 + 34 + + + 13 + 17 + 47 + + + 17 + 23 + 40 + + + 23 + 29 + 40 + + + 29 + 38 + 39 + + + 38 + 70 + 39 + + + 70 + 721 + 37 + + + + + + + parent + idx + + + 12 + + + 1 + 2 + 44 + + + 2 + 3 + 45 + + + 3 + 4 + 32 + + + 4 + 5 + 27 + + + 5 + 7 + 38 + + + 7 + 10 + 47 + + + 10 + 13 + 34 + + + 13 + 17 + 47 + + + 17 + 23 + 40 + + + 23 + 29 + 40 + + + 29 + 38 + 39 + + + 38 + 70 + 39 + + + 70 + 721 + 37 + + + + + + + idx + id + + + 12 + + + 1 + 2 + 429 + + + 2 + 3 + 53 + + + 3 + 8 + 66 + + + 8 + 16 + 57 + + + 16 + 44 + 54 + + + 44 + 311 + 54 + + + 323 + 510 + 7 + + + + + + + idx + parent + + + 12 + + + 1 + 2 + 429 + + + 2 + 3 + 53 + + + 3 + 8 + 66 + + + 8 + 16 + 57 + + + 16 + 44 + 54 + + + 44 + 311 + 54 + + + 323 + 510 + 7 + + + + + + + + + comments + 25724 + + + id + 25724 + + + kind + 2 + + + parent + 12083 + + + idx + 156 + + + text + 20683 + + + + + id + kind + + + 12 + + + 1 + 2 + 25724 + + + + + + + id + parent + + + 12 + + + 1 + 2 + 25724 + + + + + + + id + idx + + + 12 + + + 1 + 2 + 25724 + + + + + + + id + text + + + 12 + + + 1 + 2 + 25724 + + + + + + + kind + id + + + 12 + + + 846 + 847 + 1 + + + 24878 + 24879 + 1 + + + + + + + kind + parent + + + 12 + + + 846 + 847 + 1 + + + 11239 + 11240 + 1 + + + + + + + kind + idx + + + 12 + + + 2 + 3 + 1 + + + 156 + 157 + 1 + + + + + + + kind + text + + + 12 + + + 690 + 691 + 1 + + + 19993 + 19994 + 1 + + + + + + + parent + id + + + 12 + + + 1 + 2 + 7828 + + + 2 + 3 + 1787 + + + 3 + 4 + 1289 + + + 4 + 11 + 937 + + + 11 + 157 + 242 + + + + + + + parent + kind + + + 12 + + + 1 + 2 + 12081 + + + 2 + 3 + 2 + + + + + + + parent + idx + + + 12 + + + 1 + 2 + 7828 + + + 2 + 3 + 1787 + + + 3 + 4 + 1289 + + + 4 + 11 + 937 + + + 11 + 157 + 242 + + + + + + + parent + text + + + 12 + + + 1 + 2 + 7828 + + + 2 + 3 + 1817 + + + 3 + 4 + 1275 + + + 4 + 10 + 937 + + + 10 + 131 + 226 + + + + + + + idx + id + + + 12 + + + 1 + 2 + 36 + + + 2 + 4 + 13 + + + 4 + 5 + 16 + + + 5 + 7 + 12 + + + 7 + 9 + 12 + + + 9 + 11 + 6 + + + 12 + 14 + 13 + + + 14 + 24 + 13 + + + 26 + 52 + 12 + + + 59 + 218 + 12 + + + 242 + 12084 + 11 + + + + + + + idx + kind + + + 12 + + + 1 + 2 + 154 + + + 2 + 3 + 2 + + + + + + + idx + parent + + + 12 + + + 1 + 2 + 36 + + + 2 + 4 + 13 + + + 4 + 5 + 16 + + + 5 + 7 + 12 + + + 7 + 9 + 12 + + + 9 + 11 + 6 + + + 12 + 14 + 13 + + + 14 + 24 + 13 + + + 26 + 52 + 12 + + + 59 + 218 + 12 + + + 242 + 12084 + 11 + + + + + + + idx + text + + + 12 + + + 1 + 2 + 36 + + + 2 + 4 + 14 + + + 4 + 5 + 18 + + + 5 + 7 + 14 + + + 7 + 9 + 11 + + + 9 + 12 + 14 + + + 12 + 17 + 12 + + + 19 + 36 + 13 + + + 39 + 128 + 12 + + + 165 + 10500 + 12 + + + + + + + text + id + + + 12 + + + 1 + 2 + 19550 + + + 2 + 1935 + 1133 + + + + + + + text + kind + + + 12 + + + 1 + 2 + 20683 + + + + + + + text + parent + + + 12 + + + 1 + 2 + 19575 + + + 2 + 828 + 1108 + + + + + + + text + idx + + + 12 + + + 1 + 2 + 20523 + + + 2 + 107 + 160 + + + + + + + + + doc_comments + 4330 + + + node + 4330 + + + comment + 4330 + + + + + node + comment + + + 12 + + + 1 + 2 + 4330 + + + + + + + comment + node + + + 12 + + + 1 + 2 + 4330 + + + + + + + + + exprs + 414037 + + + id + 414037 + + + kind + 48 + + + parent + 219324 + + + idx + 5163 + + + + + id + kind + + + 12 + + + 1 + 2 + 414037 + + + + + + + id + parent + + + 12 + + + 1 + 2 + 414037 + + + + + + + id + idx + + + 12 + + + 1 + 2 + 414037 + + + + + + + kind + id + + + 12 + + + 7 + 20 + 4 + + + 21 + 54 + 4 + + + 57 + 142 + 4 + + + 146 + 236 + 4 + + + 248 + 344 + 4 + + + 509 + 620 + 4 + + + 678 + 839 + 4 + + + 1013 + 1235 + 4 + + + 1272 + 2705 + 4 + + + 3244 + 4582 + 4 + + + 5616 + 10361 + 4 + + + 24892 + 237317 + 4 + + + + + + + kind + parent + + + 12 + + + 7 + 20 + 4 + + + 21 + 54 + 4 + + + 57 + 142 + 4 + + + 144 + 207 + 4 + + + 233 + 324 + 4 + + + 509 + 613 + 4 + + + 676 + 790 + 4 + + + 1013 + 1226 + 4 + + + 1239 + 1949 + 4 + + + 2582 + 3985 + 4 + + + 4252 + 10115 + 4 + + + 14086 + 154744 + 4 + + + + + + + kind + idx + + + 12 + + + 1 + 2 + 3 + + + 2 + 3 + 8 + + + 3 + 4 + 10 + + + 4 + 5 + 6 + + + 5 + 7 + 4 + + + 7 + 8 + 4 + + + 8 + 14 + 3 + + + 15 + 22 + 4 + + + 23 + 34 + 4 + + + 1057 + 5164 + 2 + + + + + + + parent + id + + + 12 + + + 1 + 2 + 65804 + + + 2 + 3 + 133334 + + + 3 + 5 + 17889 + + + 5 + 5144 + 2297 + + + + + + + parent + kind + + + 12 + + + 1 + 2 + 137263 + + + 2 + 3 + 75813 + + + 3 + 7 + 6248 + + + + + + + parent + idx + + + 12 + + + 1 + 2 + 65804 + + + 2 + 3 + 133334 + + + 3 + 5 + 17889 + + + 5 + 5144 + 2297 + + + + + + + idx + id + + + 12 + + + 1 + 2 + 3910 + + + 2 + 3 + 183 + + + 3 + 4 + 782 + + + 4 + 180006 + 288 + + + + + + + idx + kind + + + 12 + + + 1 + 2 + 4087 + + + 2 + 3 + 1033 + + + 3 + 48 + 43 + + + + + + + idx + parent + + + 12 + + + 1 + 2 + 3910 + + + 2 + 3 + 183 + + + 3 + 4 + 782 + + + 4 + 180006 + 288 + + + + + + + + + literals + 270756 + + + expr + 270756 + + + value + 25795 + + + raw + 27594 + + + + + expr + value + + + 12 + + + 1 + 2 + 270756 + + + + + + + expr + raw + + + 12 + + + 1 + 2 + 270756 + + + + + + + value + expr + + + 12 + + + 1 + 2 + 14635 + + + 2 + 3 + 3291 + + + 3 + 4 + 1783 + + + 4 + 6 + 1931 + + + 6 + 12 + 1968 + + + 12 + 139 + 1935 + + + 139 + 6840 + 252 + + + + + + + value + raw + + + 12 + + + 1 + 2 + 24051 + + + 2 + 5 + 1744 + + + + + + + raw + expr + + + 12 + + + 1 + 2 + 16038 + + + 2 + 3 + 3521 + + + 3 + 4 + 1869 + + + 4 + 7 + 2553 + + + 7 + 18 + 2129 + + + 18 + 6833 + 1484 + + + + + + + raw + value + + + 12 + + + 1 + 2 + 27594 + + + + + + + + + constvalues + 43931 + + + expr + 43931 + + + value + 16896 + + + exact + 16897 + + + + + expr + value + + + 12 + + + 1 + 2 + 43931 + + + + + + + expr + exact + + + 12 + + + 1 + 2 + 43931 + + + + + + + value + expr + + + 12 + + + 1 + 2 + 14932 + + + 2 + 4 + 1388 + + + 4 + 6766 + 576 + + + + + + + value + exact + + + 12 + + + 1 + 2 + 16895 + + + 2 + 3 + 1 + + + + + + + exact + expr + + + 12 + + + 1 + 2 + 14933 + + + 2 + 4 + 1388 + + + 4 + 6766 + 576 + + + + + + + exact + value + + + 12 + + + 1 + 2 + 16897 + + + + + + + + + fields + 19974 + + + id + 19974 + + + parent + 9600 + + + idx + 57 + + + + + id + parent + + + 12 + + + 1 + 2 + 19974 + + + + + + + id + idx + + + 12 + + + 1 + 2 + 19974 + + + + + + + parent + id + + + 12 + + + 1 + 2 + 4790 + + + 2 + 3 + 2214 + + + 3 + 4 + 1363 + + + 4 + 5 + 653 + + + 5 + 53 + 580 + + + + + + + parent + idx + + + 12 + + + 1 + 2 + 4790 + + + 2 + 3 + 2214 + + + 3 + 4 + 1363 + + + 4 + 5 + 653 + + + 5 + 53 + 580 + + + + + + + idx + id + + + 12 + + + 1 + 2 + 14 + + + 2 + 3 + 8 + + + 3 + 6 + 5 + + + 6 + 11 + 5 + + + 12 + 18 + 5 + + + 19 + 31 + 5 + + + 46 + 105 + 5 + + + 115 + 633 + 5 + + + 914 + 7063 + 5 + + + + + + + idx + parent + + + 12 + + + 1 + 2 + 14 + + + 2 + 3 + 8 + + + 3 + 6 + 5 + + + 6 + 11 + 5 + + + 12 + 18 + 5 + + + 19 + 31 + 5 + + + 46 + 105 + 5 + + + 115 + 633 + 5 + + + 914 + 7063 + 5 + + + + + + + + + stmts + 73990 + + + id + 73990 + + + kind + 33 + + + parent + 41543 + + + idx + 81 + + + + + id + kind + + + 12 + + + 1 + 2 + 73990 + + + + + + + id + parent + + + 12 + + + 1 + 2 + 73990 + + + + + + + id + idx + + + 12 + + + 1 + 2 + 73990 + + + + + + + kind + id + + + 12 + + + 2 + 3 + 1 + + + 3 + 4 + 4 + + + 5 + 9 + 3 + + + 18 + 50 + 3 + + + 63 + 72 + 3 + + + 72 + 224 + 3 + + + 301 + 379 + 3 + + + 400 + 615 + 3 + + + 654 + 2136 + 3 + + + 3476 + 7606 + 3 + + + 9225 + 9729 + 3 + + + 19358 + 19359 + 1 + + + + + + + kind + parent + + + 12 + + + 2 + 3 + 1 + + + 3 + 4 + 4 + + + 5 + 9 + 3 + + + 17 + 35 + 3 + + + 47 + 69 + 3 + + + 69 + 205 + 3 + + + 301 + 367 + 3 + + + 385 + 586 + 3 + + + 606 + 1154 + 3 + + + 1719 + 5672 + 3 + + + 5912 + 9226 + 3 + + + 18820 + 18821 + 1 + + + + + + + kind + idx + + + 12 + + + 1 + 2 + 1 + + + 2 + 3 + 5 + + + 3 + 5 + 2 + + + 5 + 8 + 3 + + + 8 + 9 + 3 + + + 9 + 13 + 3 + + + 13 + 16 + 3 + + + 16 + 17 + 2 + + + 17 + 27 + 3 + + + 27 + 33 + 3 + + + 44 + 47 + 3 + + + 55 + 82 + 2 + + + + + + + parent + id + + + 12 + + + 1 + 2 + 29362 + + + 2 + 3 + 6137 + + + 3 + 5 + 3650 + + + 5 + 82 + 2394 + + + + + + + parent + kind + + + 12 + + + 1 + 2 + 31418 + + + 2 + 3 + 5760 + + + 3 + 5 + 3597 + + + 5 + 11 + 768 + + + + + + + parent + idx + + + 12 + + + 1 + 2 + 29362 + + + 2 + 3 + 6137 + + + 3 + 5 + 3650 + + + 5 + 82 + 2394 + + + + + + + idx + id + + + 12 + + + 1 + 2 + 6 + + + 2 + 3 + 20 + + + 5 + 6 + 3 + + + 7 + 8 + 11 + + + 10 + 15 + 7 + + + 15 + 27 + 7 + + + 27 + 70 + 7 + + + 85 + 262 + 7 + + + 314 + 1279 + 7 + + + 1720 + 24879 + 6 + + + + + + + idx + kind + + + 12 + + + 1 + 2 + 12 + + + 2 + 3 + 22 + + + 3 + 5 + 7 + + + 5 + 6 + 6 + + + 6 + 7 + 4 + + + 7 + 9 + 7 + + + 9 + 13 + 7 + + + 13 + 18 + 7 + + + 20 + 28 + 6 + + + 29 + 34 + 3 + + + + + + + idx + parent + + + 12 + + + 1 + 2 + 6 + + + 2 + 3 + 20 + + + 5 + 6 + 3 + + + 7 + 8 + 11 + + + 10 + 15 + 7 + + + 15 + 27 + 7 + + + 27 + 70 + 7 + + + 85 + 262 + 7 + + + 314 + 1279 + 7 + + + 1720 + 24879 + 6 + + + + + + + + + decls + 8690 + + + id + 8690 + + + kind + 5 + + + parent + 1951 + + + idx + 226 + + + + + id + kind + + + 12 + + + 1 + 2 + 8690 + + + + + + + id + parent + + + 12 + + + 1 + 2 + 8690 + + + + + + + id + idx + + + 12 + + + 1 + 2 + 8690 + + + + + + + kind + id + + + 12 + + + 280 + 281 + 1 + + + 479 + 480 + 1 + + + 1349 + 1350 + 1 + + + 1769 + 1770 + 1 + + + 4813 + 4814 + 1 + + + + + + + kind + parent + + + 12 + + + 196 + 197 + 1 + + + 336 + 337 + 1 + + + 478 + 479 + 1 + + + 483 + 484 + 1 + + + 1566 + 1567 + 1 + + + + + + + kind + idx + + + 12 + + + 2 + 3 + 1 + + + 39 + 40 + 1 + + + 105 + 106 + 1 + + + 219 + 220 + 1 + + + 225 + 226 + 1 + + + + + + + parent + id + + + 12 + + + 1 + 2 + 1460 + + + 2 + 6 + 149 + + + 6 + 12 + 155 + + + 12 + 36 + 147 + + + 36 + 227 + 40 + + + + + + + parent + kind + + + 12 + + + 1 + 2 + 1463 + + + 2 + 3 + 111 + + + 3 + 4 + 185 + + + 4 + 5 + 141 + + + 5 + 6 + 51 + + + + + + + parent + idx + + + 12 + + + 1 + 2 + 1460 + + + 2 + 6 + 149 + + + 6 + 12 + 155 + + + 12 + 36 + 147 + + + 36 + 227 + 40 + + + + + + + idx + id + + + 12 + + + 1 + 2 + 4 + + + 2 + 3 + 30 + + + 3 + 4 + 18 + + + 4 + 5 + 66 + + + 5 + 6 + 2 + + + 6 + 7 + 31 + + + 7 + 11 + 17 + + + 11 + 31 + 17 + + + 31 + 65 + 17 + + + 67 + 275 + 17 + + + 323 + 1952 + 7 + + + + + + + idx + kind + + + 12 + + + 1 + 2 + 7 + + + 2 + 3 + 113 + + + 3 + 4 + 69 + + + 4 + 5 + 35 + + + 5 + 6 + 2 + + + + + + + idx + parent + + + 12 + + + 1 + 2 + 4 + + + 2 + 3 + 30 + + + 3 + 4 + 18 + + + 4 + 5 + 66 + + + 5 + 6 + 2 + + + 6 + 7 + 31 + + + 7 + 11 + 17 + + + 11 + 31 + 17 + + + 31 + 65 + 17 + + + 67 + 275 + 17 + + + 323 + 1952 + 7 + + + + + + + + + specs + 7889 + + + id + 7889 + + + kind + 4 + + + parent + 3877 + + + idx + 108 + + + + + id + kind + + + 12 + + + 1 + 2 + 7889 + + + + + + + id + parent + + + 12 + + + 1 + 2 + 7889 + + + + + + + id + idx + + + 12 + + + 1 + 2 + 7889 + + + + + + + kind + id + + + 12 + + + 16 + 17 + 1 + + + 1349 + 1350 + 1 + + + 3056 + 3057 + 1 + + + 3468 + 3469 + 1 + + + + + + + kind + parent + + + 12 + + + 16 + 17 + 1 + + + 479 + 480 + 1 + + + 1333 + 1334 + 1 + + + 2049 + 2050 + 1 + + + + + + + kind + idx + + + 12 + + + 1 + 2 + 1 + + + 14 + 15 + 1 + + + 36 + 37 + 1 + + + 108 + 109 + 1 + + + + + + + parent + id + + + 12 + + + 1 + 2 + 3206 + + + 2 + 6 + 343 + + + 6 + 18 + 298 + + + 18 + 109 + 30 + + + + + + + parent + kind + + + 12 + + + 1 + 2 + 3877 + + + + + + + parent + idx + + + 12 + + + 1 + 2 + 3206 + + + 2 + 6 + 343 + + + 6 + 18 + 298 + + + 18 + 109 + 30 + + + + + + + idx + id + + + 12 + + + 1 + 2 + 53 + + + 2 + 3 + 19 + + + 3 + 6 + 9 + + + 6 + 28 + 9 + + + 30 + 156 + 9 + + + 188 + 3878 + 9 + + + + + + + idx + kind + + + 12 + + + 1 + 2 + 72 + + + 2 + 3 + 22 + + + 3 + 4 + 13 + + + 4 + 5 + 1 + + + + + + + idx + parent + + + 12 + + + 1 + 2 + 53 + + + 2 + 3 + 19 + + + 3 + 6 + 9 + + + 6 + 28 + 9 + + + 30 + 156 + 9 + + + 188 + 3878 + 9 + + + + + + + + + scopes + 36775 + + + id + 36775 + + + kind + 3 + + + + + id + kind + + + 12 + + + 1 + 2 + 36775 + + + + + + + kind + id + + + 12 + + + 1 + 2 + 1 + + + 346 + 347 + 1 + + + 36428 + 36429 + 1 + + + + + + + + + scopenesting + 36774 + + + inner + 36774 + + + outer + 21713 + + + + + inner + outer + + + 12 + + + 1 + 2 + 36774 + + + + + + + outer + inner + + + 12 + + + 1 + 2 + 16964 + + + 2 + 3 + 2474 + + + 3 + 7 + 1759 + + + 7 + 347 + 516 + + + + + + + + + scopenodes + 36428 + + + node + 36428 + + + scope + 36428 + + + + + node + scope + + + 12 + + + 1 + 2 + 36428 + + + + + + + scope + node + + + 12 + + + 1 + 2 + 36428 + + + + + + + + + objects + 84909 + + + id + 84909 + + + kind + 9 + + + name + 30576 + + + + + id + kind + + + 12 + + + 1 + 2 + 84909 + + + + + + + id + name + + + 12 + + + 1 + 2 + 84909 + + + + + + + kind + id + + + 12 + + + 4 + 5 + 1 + + + 18 + 19 + 1 + + + 20 + 21 + 1 + + + 49 + 50 + 1 + + + 3468 + 3469 + 1 + + + 3602 + 3603 + 1 + + + 8857 + 8858 + 1 + + + 17793 + 17794 + 1 + + + 51098 + 51099 + 1 + + + + + + + kind + name + + + 12 + + + 4 + 5 + 1 + + + 18 + 19 + 1 + + + 20 + 21 + 1 + + + 38 + 39 + 1 + + + 203 + 204 + 1 + + + 3004 + 3005 + 1 + + + 8418 + 8419 + 1 + + + 10132 + 10133 + 1 + + + 10913 + 10914 + 1 + + + + + + + name + id + + + 12 + + + 1 + 2 + 25286 + + + 2 + 3 + 2613 + + + 3 + 20 + 2304 + + + 20 + 2222 + 373 + + + + + + + name + kind + + + 12 + + + 1 + 2 + 28809 + + + 2 + 6 + 1767 + + + + + + + + + objectscopes + 54774 + + + object + 54774 + + + scope + 13947 + + + + + object + scope + + + 12 + + + 1 + 2 + 54774 + + + + + + + scope + object + + + 12 + + + 1 + 2 + 7112 + + + 2 + 3 + 2972 + + + 3 + 4 + 1274 + + + 4 + 6 + 1264 + + + 6 + 15 + 1055 + + + 15 + 2694 + 270 + + + + + + + + + objecttypes + 84907 + + + object + 84907 + + + tp + 13462 + + + + + object + tp + + + 12 + + + 1 + 2 + 84907 + + + + + + + tp + object + + + 12 + + + 1 + 2 + 7893 + + + 2 + 3 + 2114 + + + 3 + 4 + 892 + + + 4 + 7 + 1190 + + + 7 + 25 + 1011 + + + 25 + 4267 + 362 + + + + + + + + + methodreceivers + 9873 + + + method + 9873 + + + receiver + 9873 + + + + + method + receiver + + + 12 + + + 1 + 2 + 9873 + + + + + + + receiver + method + + + 12 + + + 1 + 2 + 9873 + + + + + + + + + fieldstructs + 10934 + + + field + 10934 + + + struct + 2408 + + + + + field + struct + + + 12 + + + 1 + 2 + 10934 + + + + + + + struct + field + + + 12 + + + 1 + 2 + 260 + + + 2 + 3 + 677 + + + 3 + 4 + 468 + + + 4 + 5 + 292 + + + 5 + 6 + 194 + + + 6 + 8 + 208 + + + 8 + 13 + 199 + + + 13 + 65 + 110 + + + + + + + + + methodhosts + 838 + + + method + 699 + + + host + 258 + + + + + method + host + + + 12 + + + 1 + 2 + 625 + + + 2 + 3 + 56 + + + 3 + 16 + 18 + + + + + + + host + method + + + 12 + + + 1 + 2 + 99 + + + 2 + 3 + 56 + + + 3 + 4 + 37 + + + 4 + 5 + 20 + + + 5 + 6 + 15 + + + 6 + 11 + 21 + + + 11 + 53 + 10 + + + + + + + + + defs + 40703 + + + ident + 40703 + + + object + 40490 + + + + + ident + object + + + 12 + + + 1 + 2 + 40703 + + + + + + + object + ident + + + 12 + + + 1 + 2 + 40383 + + + 2 + 15 + 107 + + + + + + + + + uses + 195902 + + + ident + 195902 + + + object + 41616 + + + + + ident + object + + + 12 + + + 1 + 2 + 195902 + + + + + + + object + ident + + + 12 + + + 1 + 2 + 15493 + + + 2 + 3 + 9727 + + + 3 + 4 + 5056 + + + 4 + 5 + 2974 + + + 5 + 7 + 3203 + + + 7 + 14 + 3336 + + + 14 + 6833 + 1827 + + + + + + + + + types + 18132 + + + id + 18132 + + + kind + 37 + + + + + id + kind + + + 12 + + + 1 + 2 + 18132 + + + + + + + kind + id + + + 12 + + + 1 + 2 + 25 + + + 10 + 30 + 3 + + + 247 + 431 + 3 + + + 559 + 1904 + 3 + + + 2409 + 8011 + 3 + + + + + + + + + type_of + 397965 + + + expr + 397965 + + + tp + 8687 + + + + + expr + tp + + + 12 + + + 1 + 2 + 397965 + + + + + + + tp + expr + + + 12 + + + 1 + 2 + 2019 + + + 2 + 3 + 967 + + + 3 + 4 + 711 + + + 4 + 5 + 388 + + + 5 + 7 + 780 + + + 7 + 10 + 772 + + + 10 + 15 + 734 + + + 15 + 23 + 700 + + + 23 + 43 + 652 + + + 43 + 143 + 652 + + + 143 + 46949 + 312 + + + + + + + + + typename + 3567 + + + tp + 3567 + + + name + 2983 + + + + + tp + name + + + 12 + + + 1 + 2 + 3567 + + + + + + + name + tp + + + 12 + + + 1 + 2 + 2660 + + + 2 + 4 + 267 + + + 4 + 17 + 56 + + + + + + + + + key_type + 430 + + + map + 430 + + + tp + 149 + + + + + map + tp + + + 12 + + + 1 + 2 + 430 + + + + + + + tp + map + + + 12 + + + 1 + 2 + 106 + + + 2 + 3 + 17 + + + 3 + 6 + 12 + + + 6 + 13 + 12 + + + 20 + 136 + 2 + + + + + + + + + element_type + 1412 + + + container + 1412 + + + tp + 916 + + + + + container + tp + + + 12 + + + 1 + 2 + 1412 + + + + + + + tp + container + + + 12 + + + 1 + 2 + 773 + + + 2 + 3 + 94 + + + 3 + 68 + 49 + + + + + + + + + base_type + 1903 + + + ptr + 1903 + + + tp + 1903 + + + + + ptr + tp + + + 12 + + + 1 + 2 + 1903 + + + + + + + tp + ptr + + + 12 + + + 1 + 2 + 1903 + + + + + + + + + underlying_type + 3567 + + + named + 3567 + + + tp + 2755 + + + + + named + tp + + + 12 + + + 1 + 2 + 3567 + + + + + + + tp + named + + + 12 + + + 1 + 2 + 2582 + + + 2 + 154 + 173 + + + + + + + + + component_types + 36474 + + + parent + 11221 + + + index + 74 + + + name + 5540 + + + tp + 4295 + + + + + parent + index + + + 12 + + + 1 + 2 + 1198 + + + 2 + 3 + 3864 + + + 3 + 4 + 2953 + + + 4 + 5 + 1446 + + + 5 + 6 + 780 + + + 6 + 13 + 860 + + + 13 + 65 + 120 + + + + + + + parent + name + + + 12 + + + 1 + 2 + 8936 + + + 2 + 3 + 733 + + + 3 + 6 + 1008 + + + 6 + 64 + 544 + + + + + + + parent + tp + + + 12 + + + 1 + 2 + 2194 + + + 2 + 3 + 4537 + + + 3 + 4 + 2475 + + + 4 + 5 + 1110 + + + 5 + 12 + 848 + + + 12 + 52 + 57 + + + + + + + index + parent + + + 12 + + + 1 + 2 + 15 + + + 2 + 4 + 6 + + + 4 + 7 + 4 + + + 8 + 13 + 6 + + + 13 + 18 + 6 + + + 18 + 28 + 6 + + + 29 + 49 + 6 + + + 52 + 82 + 6 + + + 89 + 193 + 6 + + + 232 + 824 + 6 + + + 1505 + 6458 + 6 + + + 10274 + 10275 + 1 + + + + + + + index + name + + + 12 + + + 1 + 2 + 22 + + + 2 + 6 + 6 + + + 6 + 9 + 6 + + + 9 + 16 + 4 + + + 16 + 24 + 6 + + + 24 + 37 + 6 + + + 39 + 61 + 6 + + + 69 + 116 + 6 + + + 153 + 379 + 6 + + + 475 + 1260 + 6 + + + + + + + index + tp + + + 12 + + + 1 + 2 + 15 + + + 2 + 4 + 6 + + + 4 + 7 + 6 + + + 7 + 11 + 5 + + + 11 + 14 + 5 + + + 15 + 19 + 6 + + + 20 + 27 + 5 + + + 29 + 44 + 6 + + + 45 + 72 + 6 + + + 86 + 161 + 6 + + + 224 + 1436 + 6 + + + 1878 + 2153 + 2 + + + + + + + name + parent + + + 12 + + + 1 + 2 + 3941 + + + 2 + 3 + 851 + + + 3 + 6 + 484 + + + 6 + 8917 + 264 + + + + + + + name + index + + + 12 + + + 1 + 2 + 4284 + + + 2 + 3 + 737 + + + 3 + 6 + 440 + + + 6 + 28 + 79 + + + + + + + name + tp + + + 12 + + + 1 + 2 + 4599 + + + 2 + 3 + 518 + + + 3 + 21 + 416 + + + 21 + 3014 + 7 + + + + + + + tp + parent + + + 12 + + + 1 + 2 + 2055 + + + 2 + 3 + 812 + + + 3 + 4 + 408 + + + 4 + 6 + 394 + + + 6 + 11 + 342 + + + 11 + 2187 + 284 + + + + + + + tp + index + + + 12 + + + 1 + 2 + 2111 + + + 2 + 3 + 859 + + + 3 + 4 + 580 + + + 4 + 5 + 352 + + + 5 + 10 + 328 + + + 10 + 51 + 65 + + + + + + + tp + name + + + 12 + + + 1 + 2 + 2897 + + + 2 + 3 + 865 + + + 3 + 5 + 343 + + + 5 + 738 + 190 + + + + + + + + + array_length + 293 + + + tp + 293 + + + len + 103 + + + + + tp + len + + + 12 + + + 1 + 2 + 293 + + + + + + + len + tp + + + 12 + + + 1 + 2 + 62 + + + 2 + 3 + 15 + + + 3 + 4 + 7 + + + 4 + 7 + 8 + + + 7 + 15 + 7 + + + 15 + 26 + 4 + + + + + + + + + type_objects + 3567 + + + tp + 3567 + + + object + 3567 + + + + + tp + object + + + 12 + + + 1 + 2 + 3567 + + + + + + + object + tp + + + 12 + + + 1 + 2 + 3567 + + + + + + + + + packages + 346 + + + id + 346 + + + name + 281 + + + path + 346 + + + scope + 346 + + + + + id + name + + + 12 + + + 1 + 2 + 346 + + + + + + + id + path + + + 12 + + + 1 + 2 + 346 + + + + + + + id + scope + + + 12 + + + 1 + 2 + 346 + + + + + + + name + id + + + 12 + + + 1 + 2 + 255 + + + 2 + 3 + 23 + + + 3 + 40 + 3 + + + + + + + name + path + + + 12 + + + 1 + 2 + 255 + + + 2 + 3 + 23 + + + 3 + 40 + 3 + + + + + + + name + scope + + + 12 + + + 1 + 2 + 255 + + + 2 + 3 + 23 + + + 3 + 40 + 3 + + + + + + + path + id + + + 12 + + + 1 + 2 + 346 + + + + + + + path + name + + + 12 + + + 1 + 2 + 346 + + + + + + + path + scope + + + 12 + + + 1 + 2 + 346 + + + + + + + scope + id + + + 12 + + + 1 + 2 + 346 + + + + + + + scope + name + + + 12 + + + 1 + 2 + 346 + + + + + + + scope + path + + + 12 + + + 1 + 2 + 346 + + + + + + + + + modexprs + 9 + + + id + 9 + + + kind + 4 + + + parent + 2 + + + idx + 6 + + + + + id + kind + + + 12 + + + 1 + 2 + 9 + + + + + + + id + parent + + + 12 + + + 1 + 2 + 9 + + + + + + + id + idx + + + 12 + + + 1 + 2 + 9 + + + + + + + kind + id + + + 12 + + + 1 + 2 + 3 + + + 6 + 7 + 1 + + + + + + + kind + parent + + + 12 + + + 1 + 2 + 3 + + + 2 + 3 + 1 + + + + + + + kind + idx + + + 12 + + + 1 + 2 + 3 + + + 5 + 6 + 1 + + + + + + + parent + id + + + 12 + + + 3 + 4 + 1 + + + 6 + 7 + 1 + + + + + + + parent + kind + + + 12 + + + 2 + 3 + 1 + + + 3 + 4 + 1 + + + + + + + parent + idx + + + 12 + + + 3 + 4 + 1 + + + 6 + 7 + 1 + + + + + + + idx + id + + + 12 + + + 1 + 2 + 3 + + + 2 + 3 + 3 + + + + + + + idx + kind + + + 12 + + + 1 + 2 + 4 + + + 2 + 3 + 2 + + + + + + + idx + parent + + + 12 + + + 1 + 2 + 3 + + + 2 + 3 + 3 + + + + + + + + + modtokens + 13 + + + token + 13 + + + parent + 7 + + + idx + 2 + + + + + token + parent + + + 12 + + + 1 + 2 + 13 + + + + + + + token + idx + + + 12 + + + 1 + 2 + 13 + + + + + + + parent + token + + + 12 + + + 1 + 2 + 1 + + + 2 + 3 + 6 + + + + + + + parent + idx + + + 12 + + + 1 + 2 + 1 + + + 2 + 3 + 6 + + + + + + + idx + token + + + 12 + + + 6 + 7 + 1 + + + 7 + 8 + 1 + + + + + + + idx + parent + + + 12 + + + 6 + 7 + 1 + + + 7 + 8 + 1 + + + + + + + + + errors + 0 + + + id + 0 + + + kind + 0 + + + msg + 0 + + + rawpos + 0 + + + file + 0 + + + line + 0 + + + col + 0 + + + package + 0 + + + idx + 0 + + + + + id + kind + + + 12 + + + 1 + 2 + 1 + + + + + + + id + msg + + + 12 + + + 1 + 2 + 1 + + + + + + + id + rawpos + + + 12 + + + 1 + 2 + 1 + + + + + + + id + file + + + 12 + + + 1 + 2 + 1 + + + + + + + id + line + + + 12 + + + 1 + 2 + 1 + + + + + + + id + col + + + 12 + + + 1 + 2 + 1 + + + + + + + id + package + + + 12 + + + 1 + 2 + 1 + + + + + + + id + idx + + + 12 + + + 1 + 2 + 1 + + + + + + + kind + id + + + 12 + + + + + + kind + msg + + + 12 + + + + + + kind + rawpos + + + 12 + + + + + + kind + file + + + 12 + + + + + + kind + line + + + 12 + + + + + + kind + col + + + 12 + + + + + + kind + package + + + 12 + + + + + + kind + idx + + + 12 + + + + + + msg + id + + + 12 + + + + + + msg + kind + + + 12 + + + + + + msg + rawpos + + + 12 + + + + + + msg + file + + + 12 + + + + + + msg + line + + + 12 + + + + + + msg + col + + + 12 + + + + + + msg + package + + + 12 + + + + + + msg + idx + + + 12 + + + + + + rawpos + id + + + 12 + + + + + + rawpos + kind + + + 12 + + + + + + rawpos + msg + + + 12 + + + + + + rawpos + file + + + 12 + + + + + + rawpos + line + + + 12 + + + + + + rawpos + col + + + 12 + + + + + + rawpos + package + + + 12 + + + + + + rawpos + idx + + + 12 + + + + + + file + id + + + 12 + + + + + + file + kind + + + 12 + + + + + + file + msg + + + 12 + + + + + + file + rawpos + + + 12 + + + + + + file + line + + + 12 + + + + + + file + col + + + 12 + + + + + + file + package + + + 12 + + + + + + file + idx + + + 12 + + + + + + line + id + + + 12 + + + + + + line + kind + + + 12 + + + + + + line + msg + + + 12 + + + + + + line + rawpos + + + 12 + + + + + + line + file + + + 12 + + + + + + line + col + + + 12 + + + + + + line + package + + + 12 + + + + + + line + idx + + + 12 + + + + + + col + id + + + 12 + + + + + + col + kind + + + 12 + + + + + + col + msg + + + 12 + + + + + + col + rawpos + + + 12 + + + + + + col + file + + + 12 + + + + + + col + line + + + 12 + + + + + + col + package + + + 12 + + + + + + col + idx + + + 12 + + + + + + package + id + + + 12 + + + + + + package + kind + + + 12 + + + + + + package + msg + + + 12 + + + + + + package + rawpos + + + 12 + + + + + + package + file + + + 12 + + + + + + package + line + + + 12 + + + + + + package + col + + + 12 + + + + + + package + idx + + + 12 + + + + + + idx + id + + + 12 + + + + + + idx + kind + + + 12 + + + + + + idx + msg + + + 12 + + + + + + idx + rawpos + + + 12 + + + + + + idx + file + + + 12 + + + + + + idx + line + + + 12 + + + + + + idx + col + + + 12 + + + + + + idx + package + + + 12 + + + + + + + + has_ellipsis + 268 + + + id + 268 + + + + + + diff --git a/go/ql/src/experimental/CWE-79/HTMLTemplateEscapingPassthrough.ql b/go/ql/src/experimental/CWE-79/HTMLTemplateEscapingPassthrough.ql index 0aff713f26bc..91b03e294ba4 100644 --- a/go/ql/src/experimental/CWE-79/HTMLTemplateEscapingPassthrough.ql +++ b/go/ql/src/experimental/CWE-79/HTMLTemplateEscapingPassthrough.ql @@ -41,7 +41,7 @@ module UntrustedToPassthroughTypeConversionConfig implements DataFlow::ConfigSig additional predicate isSinkToPassthroughType(DataFlow::TypeCastNode sink, PassthroughTypeName name) { exists(Type typ | typ = sink.getResultType() and - typ.getUnderlyingType*().hasQualifiedName("html/template", name) + unalias(typ).hasQualifiedName("html/template", name) ) } @@ -80,7 +80,7 @@ module PassthroughTypeConversionToTemplateExecutionCallConfig implements DataFlo ) { exists(Type typ | typ = source.getResultType() and - typ.getUnderlyingType*().hasQualifiedName("html/template", name) + unalias(typ).hasQualifiedName("html/template", name) ) } diff --git a/go/ql/test/library-tests/semmle/go/Decl/TypeEntities.expected b/go/ql/test/library-tests/semmle/go/Decl/TypeEntities.expected index 2de33d124076..d25336d987cf 100644 --- a/go/ql/test/library-tests/semmle/go/Decl/TypeEntities.expected +++ b/go/ql/test/library-tests/semmle/go/Decl/TypeEntities.expected @@ -1,2 +1,2 @@ | main.go:3:6:3:11 | status | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Decl | status | -| main.go:5:6:5:12 | intlist | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Decl | []int | +| main.go:5:6:5:12 | intlist | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Decl | intlist | diff --git a/go/ql/test/library-tests/semmle/go/Function/GenericFunctionInstantiationExpr.expected b/go/ql/test/library-tests/semmle/go/Function/GenericFunctionInstantiationExpr.expected index 6528a0ae7f3d..3b0ee59bde68 100644 --- a/go/ql/test/library-tests/semmle/go/Function/GenericFunctionInstantiationExpr.expected +++ b/go/ql/test/library-tests/semmle/go/Function/GenericFunctionInstantiationExpr.expected @@ -1,8 +1,8 @@ -| genericFunctions.go:25:2:25:33 | generic function instantiation expression | genericFunctions.go:25:2:25:28 | GenericFunctionOneTypeParam | 0 | genericFunctions.go:25:30:25:32 | int | -| genericFunctions.go:26:2:26:36 | generic function instantiation expression | genericFunctions.go:26:2:26:28 | GenericFunctionOneTypeParam | 0 | genericFunctions.go:26:30:26:35 | string | -| genericFunctions.go:44:6:44:48 | generic function instantiation expression | genericFunctions.go:44:6:44:33 | GenericFunctionTwoTypeParams | 0 | genericFunctions.go:44:35:44:40 | string | -| genericFunctions.go:44:6:44:48 | generic function instantiation expression | genericFunctions.go:44:6:44:33 | GenericFunctionTwoTypeParams | 1 | genericFunctions.go:44:43:44:47 | int64 | -| genericFunctions.go:45:6:45:50 | generic function instantiation expression | genericFunctions.go:45:6:45:33 | GenericFunctionTwoTypeParams | 0 | genericFunctions.go:45:35:45:40 | string | -| genericFunctions.go:45:6:45:50 | generic function instantiation expression | genericFunctions.go:45:6:45:33 | GenericFunctionTwoTypeParams | 1 | genericFunctions.go:45:43:45:49 | float64 | -| genericFunctions.go:141:6:141:41 | generic function instantiation expression | genericFunctions.go:141:6:141:33 | GenericFunctionInAnotherFile | 0 | genericFunctions.go:141:35:141:40 | string | -| genericFunctions.go:146:6:146:55 | generic function instantiation expression | genericFunctions.go:146:6:146:47 | selection of GenericFunctionInAnotherPackage | 0 | genericFunctions.go:146:49:146:54 | string | +| genericFunctions.go:27:2:27:33 | generic function instantiation expression | genericFunctions.go:27:2:27:28 | GenericFunctionOneTypeParam | 0 | genericFunctions.go:27:30:27:32 | int | +| genericFunctions.go:28:2:28:36 | generic function instantiation expression | genericFunctions.go:28:2:28:28 | GenericFunctionOneTypeParam | 0 | genericFunctions.go:28:30:28:35 | string | +| genericFunctions.go:46:6:46:48 | generic function instantiation expression | genericFunctions.go:46:6:46:33 | GenericFunctionTwoTypeParams | 0 | genericFunctions.go:46:35:46:40 | string | +| genericFunctions.go:46:6:46:48 | generic function instantiation expression | genericFunctions.go:46:6:46:33 | GenericFunctionTwoTypeParams | 1 | genericFunctions.go:46:43:46:47 | int64 | +| genericFunctions.go:47:6:47:50 | generic function instantiation expression | genericFunctions.go:47:6:47:33 | GenericFunctionTwoTypeParams | 0 | genericFunctions.go:47:35:47:40 | string | +| genericFunctions.go:47:6:47:50 | generic function instantiation expression | genericFunctions.go:47:6:47:33 | GenericFunctionTwoTypeParams | 1 | genericFunctions.go:47:43:47:49 | float64 | +| genericFunctions.go:149:6:149:41 | generic function instantiation expression | genericFunctions.go:149:6:149:33 | GenericFunctionInAnotherFile | 0 | genericFunctions.go:149:35:149:40 | string | +| genericFunctions.go:154:6:154:55 | generic function instantiation expression | genericFunctions.go:154:6:154:47 | selection of GenericFunctionInAnotherPackage | 0 | genericFunctions.go:154:49:154:54 | string | diff --git a/go/ql/test/library-tests/semmle/go/Function/TypeParamType.expected b/go/ql/test/library-tests/semmle/go/Function/TypeParamType.expected index c1d09ddb080a..ceaf57ff6046 100644 --- a/go/ql/test/library-tests/semmle/go/Function/TypeParamType.expected +++ b/go/ql/test/library-tests/semmle/go/Function/TypeParamType.expected @@ -1,215 +1,215 @@ numberOfTypeParameters | genericFunctions2.go:3:6:3:33 | GenericFunctionInAnotherFile | 1 | -| genericFunctions.go:9:6:9:32 | GenericFunctionOneTypeParam | 1 | -| genericFunctions.go:15:6:15:33 | GenericFunctionTwoTypeParams | 2 | -| genericFunctions.go:81:6:81:19 | GenericStruct1 | 1 | -| genericFunctions.go:84:6:84:19 | GenericStruct2 | 2 | -| genericFunctions.go:87:30:87:31 | f1 | 1 | -| genericFunctions.go:92:31:92:32 | g1 | 1 | -| genericFunctions.go:95:35:95:36 | f2 | 2 | -| genericFunctions.go:98:36:98:37 | g2 | 2 | -| genericFunctions.go:111:6:111:12 | Element | 1 | -| genericFunctions.go:115:6:115:9 | List | 1 | -| genericFunctions.go:120:19:120:23 | MyLen | 1 | -| genericFunctions.go:124:6:124:19 | NodeConstraint | 1 | -| genericFunctions.go:128:6:128:19 | EdgeConstraint | 1 | -| genericFunctions.go:132:6:132:10 | Graph | 2 | -| genericFunctions.go:134:6:134:8 | New | 2 | -| genericFunctions.go:138:29:138:40 | ShortestPath | 2 | -| genericFunctions.go:150:6:150:36 | multipleAnonymousTypeParamsFunc | 3 | -| genericFunctions.go:152:6:152:36 | multipleAnonymousTypeParamsType | 3 | -| genericFunctions.go:154:51:154:51 | f | 3 | +| genericFunctions.go:11:6:11:32 | GenericFunctionOneTypeParam | 1 | +| genericFunctions.go:17:6:17:33 | GenericFunctionTwoTypeParams | 2 | +| genericFunctions.go:89:6:89:19 | GenericStruct1 | 1 | +| genericFunctions.go:92:6:92:19 | GenericStruct2 | 2 | +| genericFunctions.go:95:32:95:33 | f1 | 1 | +| genericFunctions.go:100:33:100:34 | g1 | 1 | +| genericFunctions.go:103:39:103:40 | f2 | 2 | +| genericFunctions.go:106:40:106:41 | g2 | 2 | +| genericFunctions.go:119:6:119:12 | Element | 1 | +| genericFunctions.go:123:6:123:9 | List | 1 | +| genericFunctions.go:128:23:128:27 | MyLen | 1 | +| genericFunctions.go:132:6:132:19 | NodeConstraint | 1 | +| genericFunctions.go:136:6:136:19 | EdgeConstraint | 1 | +| genericFunctions.go:140:6:140:10 | Graph | 2 | +| genericFunctions.go:142:6:142:8 | New | 2 | +| genericFunctions.go:146:31:146:42 | ShortestPath | 2 | +| genericFunctions.go:158:6:158:36 | multipleAnonymousTypeParamsFunc | 3 | +| genericFunctions.go:160:6:160:36 | multipleAnonymousTypeParamsType | 3 | +| genericFunctions.go:162:51:162:51 | f | 3 | #select | cmp.Compare | 0 | T | Ordered | | cmp.Less | 0 | T | Ordered | | cmp.Or | 0 | T | comparable | | cmp.isNaN | 0 | T | Ordered | -| codeql-go-tests/function.EdgeConstraint | 0 | Node | interface { } | -| codeql-go-tests/function.Element | 0 | S | interface { } | -| codeql-go-tests/function.GenericFunctionInAnotherFile | 0 | T | interface { } | -| codeql-go-tests/function.GenericFunctionOneTypeParam | 0 | T | interface { } | -| codeql-go-tests/function.GenericFunctionTwoTypeParams | 0 | K | comparable | -| codeql-go-tests/function.GenericFunctionTwoTypeParams | 1 | V | interface { int64 \| float64 } | -| codeql-go-tests/function.GenericStruct1 | 0 | T | interface { } | -| codeql-go-tests/function.GenericStruct1.f1 | 0 | TF1 | interface { } | -| codeql-go-tests/function.GenericStruct1.g1 | 0 | TG1 | interface { } | -| codeql-go-tests/function.GenericStruct2 | 0 | S | interface { } | -| codeql-go-tests/function.GenericStruct2 | 1 | T | interface { } | -| codeql-go-tests/function.GenericStruct2.f2 | 0 | SF2 | interface { } | -| codeql-go-tests/function.GenericStruct2.f2 | 1 | TF2 | interface { } | -| codeql-go-tests/function.GenericStruct2.g2 | 0 | SG2 | interface { } | -| codeql-go-tests/function.GenericStruct2.g2 | 1 | TG2 | interface { } | -| codeql-go-tests/function.Graph | 0 | Node | NodeConstraint | -| codeql-go-tests/function.Graph | 1 | Edge | EdgeConstraint | -| codeql-go-tests/function.Graph.ShortestPath | 0 | Node | NodeConstraint | -| codeql-go-tests/function.Graph.ShortestPath | 1 | Edge | EdgeConstraint | -| codeql-go-tests/function.List | 0 | T | interface { } | -| codeql-go-tests/function.List.MyLen | 0 | U | interface { } | -| codeql-go-tests/function.New | 0 | Node | NodeConstraint | -| codeql-go-tests/function.New | 1 | Edge | EdgeConstraint | -| codeql-go-tests/function.NodeConstraint | 0 | Edge | interface { } | -| codeql-go-tests/function.multipleAnonymousTypeParamsFunc | 0 | _ | interface { } | +| codeql-go-tests/function.EdgeConstraint | 0 | TP117 | any | +| codeql-go-tests/function.Element | 0 | TP113 | any | +| codeql-go-tests/function.GenericFunctionInAnotherFile | 0 | TP200 | any | +| codeql-go-tests/function.GenericFunctionOneTypeParam | 0 | TP101 | any | +| codeql-go-tests/function.GenericFunctionTwoTypeParams | 0 | TP102 | comparable | +| codeql-go-tests/function.GenericFunctionTwoTypeParams | 1 | TP103 | interface { int64 \| float64 } | +| codeql-go-tests/function.GenericStruct1 | 0 | TP104 | interface { } | +| codeql-go-tests/function.GenericStruct1.f1 | 0 | TP107 | interface { } | +| codeql-go-tests/function.GenericStruct1.g1 | 0 | TP108 | interface { } | +| codeql-go-tests/function.GenericStruct2 | 0 | TP105 | any | +| codeql-go-tests/function.GenericStruct2 | 1 | TP106 | any | +| codeql-go-tests/function.GenericStruct2.f2 | 0 | TP109 | any | +| codeql-go-tests/function.GenericStruct2.f2 | 1 | TP110 | any | +| codeql-go-tests/function.GenericStruct2.g2 | 0 | TP111 | any | +| codeql-go-tests/function.GenericStruct2.g2 | 1 | TP112 | any | +| codeql-go-tests/function.Graph | 0 | TP118 | NodeConstraint | +| codeql-go-tests/function.Graph | 1 | TP119 | EdgeConstraint | +| codeql-go-tests/function.Graph.ShortestPath | 0 | TP122 | NodeConstraint | +| codeql-go-tests/function.Graph.ShortestPath | 1 | TP123 | EdgeConstraint | +| codeql-go-tests/function.List | 0 | TP114 | any | +| codeql-go-tests/function.List.MyLen | 0 | TP115 | any | +| codeql-go-tests/function.New | 0 | TP120 | NodeConstraint | +| codeql-go-tests/function.New | 1 | TP121 | EdgeConstraint | +| codeql-go-tests/function.NodeConstraint | 0 | TP116 | any | +| codeql-go-tests/function.multipleAnonymousTypeParamsFunc | 0 | _ | any | | codeql-go-tests/function.multipleAnonymousTypeParamsFunc | 1 | _ | interface { string } | -| codeql-go-tests/function.multipleAnonymousTypeParamsFunc | 2 | _ | interface { } | -| codeql-go-tests/function.multipleAnonymousTypeParamsType | 0 | _ | interface { } | +| codeql-go-tests/function.multipleAnonymousTypeParamsFunc | 2 | _ | any | +| codeql-go-tests/function.multipleAnonymousTypeParamsType | 0 | _ | any | | codeql-go-tests/function.multipleAnonymousTypeParamsType | 1 | _ | interface { string } | -| codeql-go-tests/function.multipleAnonymousTypeParamsType | 2 | _ | interface { } | -| codeql-go-tests/function.multipleAnonymousTypeParamsType.f | 0 | _ | interface { } | +| codeql-go-tests/function.multipleAnonymousTypeParamsType | 2 | _ | any | +| codeql-go-tests/function.multipleAnonymousTypeParamsType.f | 0 | _ | any | | codeql-go-tests/function.multipleAnonymousTypeParamsType.f | 1 | _ | interface { string } | -| codeql-go-tests/function.multipleAnonymousTypeParamsType.f | 2 | _ | interface { } | -| github.com/anotherpkg.GenericFunctionInAnotherPackage | 0 | T | interface { } | -| internal/abi.Escape | 0 | T | interface { } | +| codeql-go-tests/function.multipleAnonymousTypeParamsType.f | 2 | _ | any | +| github.com/anotherpkg.GenericFunctionInAnotherPackage | 0 | T | any | +| internal/abi.Escape | 0 | T | any | | internal/bytealg.HashStr | 0 | T | interface { string \| []uint8 } | | internal/bytealg.HashStrRev | 0 | T | interface { string \| []uint8 } | | internal/bytealg.IndexRabinKarp | 0 | T | interface { string \| []uint8 } | | internal/bytealg.LastIndexRabinKarp | 0 | T | interface { string \| []uint8 } | -| internal/runtime/atomic.Pointer.CompareAndSwap | 0 | T | interface { } | -| internal/runtime/atomic.Pointer.CompareAndSwapNoWB | 0 | T | interface { } | -| internal/runtime/atomic.Pointer.Load | 0 | T | interface { } | -| internal/runtime/atomic.Pointer.Store | 0 | T | interface { } | -| internal/runtime/atomic.Pointer.StoreNoWB | 0 | T | interface { } | -| iter.Pull | 0 | V | interface { } | -| iter.Pull2 | 0 | K | interface { } | -| iter.Pull2 | 1 | V | interface { } | -| iter.Seq | 0 | V | interface { } | -| iter.Seq2 | 0 | K | interface { } | -| iter.Seq2 | 1 | V | interface { } | +| internal/runtime/atomic.Pointer.CompareAndSwap | 0 | T | any | +| internal/runtime/atomic.Pointer.CompareAndSwapNoWB | 0 | T | any | +| internal/runtime/atomic.Pointer.Load | 0 | T | any | +| internal/runtime/atomic.Pointer.Store | 0 | T | any | +| internal/runtime/atomic.Pointer.StoreNoWB | 0 | T | any | +| iter.Pull | 0 | V | any | +| iter.Pull2 | 0 | K | any | +| iter.Pull2 | 1 | V | any | +| iter.Seq | 0 | V | any | +| iter.Seq2 | 0 | K | any | +| iter.Seq2 | 1 | V | any | | reflect.rangeNum | 1 | N | interface { int64 \| uint64 } | | runtime.fandbits | 0 | F | floaty | | runtime.fmax | 0 | F | floaty | | runtime.fmin | 0 | F | floaty | | runtime.forbits | 0 | F | floaty | -| runtime.noEscapePtr | 0 | T | interface { } | +| runtime.noEscapePtr | 0 | T | any | | slices.All | 0 | Slice | interface { ~[]E } | -| slices.All | 1 | E | interface { } | +| slices.All | 1 | E | any | | slices.AppendSeq | 0 | Slice | interface { ~[]E } | -| slices.AppendSeq | 1 | E | interface { } | +| slices.AppendSeq | 1 | E | any | | slices.Backward | 0 | Slice | interface { ~[]E } | -| slices.Backward | 1 | E | interface { } | +| slices.Backward | 1 | E | any | | slices.BinarySearch | 0 | S | interface { ~[]E } | | slices.BinarySearch | 1 | E | Ordered | | slices.BinarySearchFunc | 0 | S | interface { ~[]E } | -| slices.BinarySearchFunc | 1 | E | interface { } | -| slices.BinarySearchFunc | 2 | T | interface { } | +| slices.BinarySearchFunc | 1 | E | any | +| slices.BinarySearchFunc | 2 | T | any | | slices.Chunk | 0 | Slice | interface { ~[]E } | -| slices.Chunk | 1 | E | interface { } | +| slices.Chunk | 1 | E | any | | slices.Clip | 0 | S | interface { ~[]E } | -| slices.Clip | 1 | E | interface { } | +| slices.Clip | 1 | E | any | | slices.Clone | 0 | S | interface { ~[]E } | -| slices.Clone | 1 | E | interface { } | -| slices.Collect | 0 | E | interface { } | +| slices.Clone | 1 | E | any | +| slices.Collect | 0 | E | any | | slices.Compact | 0 | S | interface { ~[]E } | | slices.Compact | 1 | E | comparable | | slices.CompactFunc | 0 | S | interface { ~[]E } | -| slices.CompactFunc | 1 | E | interface { } | +| slices.CompactFunc | 1 | E | any | | slices.Compare | 0 | S | interface { ~[]E } | | slices.Compare | 1 | E | Ordered | | slices.CompareFunc | 0 | S1 | interface { ~[]E1 } | | slices.CompareFunc | 1 | S2 | interface { ~[]E2 } | -| slices.CompareFunc | 2 | E1 | interface { } | -| slices.CompareFunc | 3 | E2 | interface { } | +| slices.CompareFunc | 2 | E1 | any | +| slices.CompareFunc | 3 | E2 | any | | slices.Concat | 0 | S | interface { ~[]E } | -| slices.Concat | 1 | E | interface { } | +| slices.Concat | 1 | E | any | | slices.Contains | 0 | S | interface { ~[]E } | | slices.Contains | 1 | E | comparable | | slices.ContainsFunc | 0 | S | interface { ~[]E } | -| slices.ContainsFunc | 1 | E | interface { } | +| slices.ContainsFunc | 1 | E | any | | slices.Delete | 0 | S | interface { ~[]E } | -| slices.Delete | 1 | E | interface { } | +| slices.Delete | 1 | E | any | | slices.DeleteFunc | 0 | S | interface { ~[]E } | -| slices.DeleteFunc | 1 | E | interface { } | +| slices.DeleteFunc | 1 | E | any | | slices.Equal | 0 | S | interface { ~[]E } | | slices.Equal | 1 | E | comparable | | slices.EqualFunc | 0 | S1 | interface { ~[]E1 } | | slices.EqualFunc | 1 | S2 | interface { ~[]E2 } | -| slices.EqualFunc | 2 | E1 | interface { } | -| slices.EqualFunc | 3 | E2 | interface { } | +| slices.EqualFunc | 2 | E1 | any | +| slices.EqualFunc | 3 | E2 | any | | slices.Grow | 0 | S | interface { ~[]E } | -| slices.Grow | 1 | E | interface { } | +| slices.Grow | 1 | E | any | | slices.Index | 0 | S | interface { ~[]E } | | slices.Index | 1 | E | comparable | | slices.IndexFunc | 0 | S | interface { ~[]E } | -| slices.IndexFunc | 1 | E | interface { } | +| slices.IndexFunc | 1 | E | any | | slices.Insert | 0 | S | interface { ~[]E } | -| slices.Insert | 1 | E | interface { } | +| slices.Insert | 1 | E | any | | slices.IsSorted | 0 | S | interface { ~[]E } | | slices.IsSorted | 1 | E | Ordered | | slices.IsSortedFunc | 0 | S | interface { ~[]E } | -| slices.IsSortedFunc | 1 | E | interface { } | +| slices.IsSortedFunc | 1 | E | any | | slices.Max | 0 | S | interface { ~[]E } | | slices.Max | 1 | E | Ordered | | slices.MaxFunc | 0 | S | interface { ~[]E } | -| slices.MaxFunc | 1 | E | interface { } | +| slices.MaxFunc | 1 | E | any | | slices.Min | 0 | S | interface { ~[]E } | | slices.Min | 1 | E | Ordered | | slices.MinFunc | 0 | S | interface { ~[]E } | -| slices.MinFunc | 1 | E | interface { } | +| slices.MinFunc | 1 | E | any | | slices.Repeat | 0 | S | interface { ~[]E } | -| slices.Repeat | 1 | E | interface { } | +| slices.Repeat | 1 | E | any | | slices.Replace | 0 | S | interface { ~[]E } | -| slices.Replace | 1 | E | interface { } | +| slices.Replace | 1 | E | any | | slices.Reverse | 0 | S | interface { ~[]E } | -| slices.Reverse | 1 | E | interface { } | +| slices.Reverse | 1 | E | any | | slices.Sort | 0 | S | interface { ~[]E } | | slices.Sort | 1 | E | Ordered | | slices.SortFunc | 0 | S | interface { ~[]E } | -| slices.SortFunc | 1 | E | interface { } | +| slices.SortFunc | 1 | E | any | | slices.SortStableFunc | 0 | S | interface { ~[]E } | -| slices.SortStableFunc | 1 | E | interface { } | +| slices.SortStableFunc | 1 | E | any | | slices.Sorted | 0 | E | Ordered | -| slices.SortedFunc | 0 | E | interface { } | -| slices.SortedStableFunc | 0 | E | interface { } | +| slices.SortedFunc | 0 | E | any | +| slices.SortedStableFunc | 0 | E | any | | slices.Values | 0 | Slice | interface { ~[]E } | -| slices.Values | 1 | E | interface { } | -| slices.breakPatternsCmpFunc | 0 | E | interface { } | +| slices.Values | 1 | E | any | +| slices.breakPatternsCmpFunc | 0 | E | any | | slices.breakPatternsOrdered | 0 | E | Ordered | -| slices.choosePivotCmpFunc | 0 | E | interface { } | +| slices.choosePivotCmpFunc | 0 | E | any | | slices.choosePivotOrdered | 0 | E | Ordered | -| slices.heapSortCmpFunc | 0 | E | interface { } | +| slices.heapSortCmpFunc | 0 | E | any | | slices.heapSortOrdered | 0 | E | Ordered | -| slices.insertionSortCmpFunc | 0 | E | interface { } | +| slices.insertionSortCmpFunc | 0 | E | any | | slices.insertionSortOrdered | 0 | E | Ordered | | slices.isNaN | 0 | T | Ordered | -| slices.medianAdjacentCmpFunc | 0 | E | interface { } | +| slices.medianAdjacentCmpFunc | 0 | E | any | | slices.medianAdjacentOrdered | 0 | E | Ordered | -| slices.medianCmpFunc | 0 | E | interface { } | +| slices.medianCmpFunc | 0 | E | any | | slices.medianOrdered | 0 | E | Ordered | -| slices.order2CmpFunc | 0 | E | interface { } | +| slices.order2CmpFunc | 0 | E | any | | slices.order2Ordered | 0 | E | Ordered | -| slices.overlaps | 0 | E | interface { } | -| slices.partialInsertionSortCmpFunc | 0 | E | interface { } | +| slices.overlaps | 0 | E | any | +| slices.partialInsertionSortCmpFunc | 0 | E | any | | slices.partialInsertionSortOrdered | 0 | E | Ordered | -| slices.partitionCmpFunc | 0 | E | interface { } | -| slices.partitionEqualCmpFunc | 0 | E | interface { } | +| slices.partitionCmpFunc | 0 | E | any | +| slices.partitionEqualCmpFunc | 0 | E | any | | slices.partitionEqualOrdered | 0 | E | Ordered | | slices.partitionOrdered | 0 | E | Ordered | -| slices.pdqsortCmpFunc | 0 | E | interface { } | +| slices.pdqsortCmpFunc | 0 | E | any | | slices.pdqsortOrdered | 0 | E | Ordered | -| slices.reverseRangeCmpFunc | 0 | E | interface { } | +| slices.reverseRangeCmpFunc | 0 | E | any | | slices.reverseRangeOrdered | 0 | E | Ordered | -| slices.rotateCmpFunc | 0 | E | interface { } | -| slices.rotateLeft | 0 | E | interface { } | +| slices.rotateCmpFunc | 0 | E | any | +| slices.rotateLeft | 0 | E | any | | slices.rotateOrdered | 0 | E | Ordered | -| slices.rotateRight | 0 | E | interface { } | -| slices.siftDownCmpFunc | 0 | E | interface { } | +| slices.rotateRight | 0 | E | any | +| slices.siftDownCmpFunc | 0 | E | any | | slices.siftDownOrdered | 0 | E | Ordered | -| slices.stableCmpFunc | 0 | E | interface { } | +| slices.stableCmpFunc | 0 | E | any | | slices.stableOrdered | 0 | E | Ordered | -| slices.startIdx | 0 | E | interface { } | -| slices.swapRangeCmpFunc | 0 | E | interface { } | +| slices.startIdx | 0 | E | any | +| slices.swapRangeCmpFunc | 0 | E | any | | slices.swapRangeOrdered | 0 | E | Ordered | -| slices.symMergeCmpFunc | 0 | E | interface { } | +| slices.symMergeCmpFunc | 0 | E | any | | slices.symMergeOrdered | 0 | E | Ordered | | strconv.bsearch | 0 | S | interface { ~[]E } | | strconv.bsearch | 1 | E | interface { ~uint16 \| ~uint32 } | -| sync.OnceValue | 0 | T | interface { } | -| sync.OnceValues | 0 | T1 | interface { } | -| sync.OnceValues | 1 | T2 | interface { } | -| sync/atomic.Pointer | 0 | T | interface { } | -| sync/atomic.Pointer.CompareAndSwap | 0 | T | interface { } | -| sync/atomic.Pointer.Load | 0 | T | interface { } | -| sync/atomic.Pointer.Store | 0 | T | interface { } | -| sync/atomic.Pointer.Swap | 0 | T | interface { } | +| sync.OnceValue | 0 | T | any | +| sync.OnceValues | 0 | T1 | any | +| sync.OnceValues | 1 | T2 | any | +| sync/atomic.Pointer | 0 | T | any | +| sync/atomic.Pointer.CompareAndSwap | 0 | T | any | +| sync/atomic.Pointer.Load | 0 | T | any | +| sync/atomic.Pointer.Store | 0 | T | any | +| sync/atomic.Pointer.Swap | 0 | T | any | | time.atoi | 0 | bytes | interface { []uint8 \| string } | | time.isDigit | 0 | bytes | interface { []uint8 \| string } | | time.leadingInt | 0 | bytes | interface { []uint8 \| string } | diff --git a/go/ql/test/library-tests/semmle/go/Function/genericFunctions.go b/go/ql/test/library-tests/semmle/go/Function/genericFunctions.go index 60abbbb8f112..b63d9d52b7cc 100644 --- a/go/ql/test/library-tests/semmle/go/Function/genericFunctions.go +++ b/go/ql/test/library-tests/semmle/go/Function/genericFunctions.go @@ -2,18 +2,20 @@ package main import "github.com/anotherpkg" -type T1 map[string][]string -type T2 T1 +type DefinedType1 map[string][]string +type DefinedType2 DefinedType1 +type AliasType1 = DefinedType2 +type AliasType2 = AliasType1 // A generic function with one type parameter -func GenericFunctionOneTypeParam[T any](t T) T { - var r T +func GenericFunctionOneTypeParam[TP101 any](t TP101) TP101 { + var r TP101 return r } // A generic function with two type parameter -func GenericFunctionTwoTypeParams[K comparable, V int64 | float64](m map[K]V) V { - var s V +func GenericFunctionTwoTypeParams[TP102 comparable, TP103 int64 | float64](m map[TP102]TP103) TP103 { + var s TP103 for _, v := range m { s += v } @@ -70,32 +72,38 @@ func generic_functions() { // Slice write sliceVar[0] = -1 - // Access a map through two type aliases - aliasedMap := T2{"key": []string{"value"}} + // Access a map through two named types + mapThroughNamedTypes := DefinedType2{"key": []string{"value"}} // Map read - _ = aliasedMap["key"] + _ = mapThroughNamedTypes["key"] // Map write - aliasedMap["key"][0] = "new value" + mapThroughNamedTypes["key"][0] = "new value" + // Access a map through two type aliases and two named types + mapThroughAliasedTypes := AliasType2{"key": []string{"value"}} + // Map read + _ = mapThroughAliasedTypes["key"] + // Map write + mapThroughAliasedTypes["key"][0] = "new value" } -type GenericStruct1[T any] struct { +type GenericStruct1[TP104 interface{}] struct { } -type GenericStruct2[S, T any] struct { +type GenericStruct2[TP105, TP106 any] struct { } -func (x GenericStruct1[TF1]) f1() TF1 { - var r TF1 +func (x GenericStruct1[TP107]) f1() TP107 { + var r TP107 return r } -func (x *GenericStruct1[TG1]) g1() { +func (x *GenericStruct1[TP108]) g1() { } -func (x GenericStruct2[SF2, TF2]) f2() { +func (x GenericStruct2[TP109, TP110]) f2() { } -func (x *GenericStruct2[SG2, TG2]) g2() { +func (x *GenericStruct2[TP111, TP112]) g2() { } func call_methods_with_generic_receiver() { @@ -108,34 +116,34 @@ func call_methods_with_generic_receiver() { x2.g2() } -type Element[S any] struct { - list *List[S] +type Element[TP113 any] struct { + list *List[TP113] } -type List[T any] struct { - root Element[T] +type List[TP114 any] struct { + root Element[TP114] } // Len is the number of elements in the list. -func (l *List[U]) MyLen() int { +func (l *List[TP115]) MyLen() int { return 0 } -type NodeConstraint[Edge any] interface { - Edges() []Edge +type NodeConstraint[TP116 any] interface { + Edges() []TP116 } -type EdgeConstraint[Node any] interface { - Nodes() (from, to Node) +type EdgeConstraint[TP117 any] interface { + Nodes() (from, to TP117) } -type Graph[Node NodeConstraint[Edge], Edge EdgeConstraint[Node]] struct{} +type Graph[TP118 NodeConstraint[TP119], TP119 EdgeConstraint[TP118]] struct{} -func New[Node NodeConstraint[Edge], Edge EdgeConstraint[Node]](nodes []Node) *Graph[Node, Edge] { +func New[TP120 NodeConstraint[TP121], TP121 EdgeConstraint[TP120]](nodes []TP120) *Graph[TP120, TP121] { return nil } -func (g *Graph[Node, Edge]) ShortestPath(from, to Node) []Edge { return []Edge{} } +func (g *Graph[TP122, TP123]) ShortestPath(from, to TP122) []TP123 { return []TP123{} } func callFunctionsInAnotherFile() { _ = GenericFunctionInAnotherFile[string]("world") diff --git a/go/ql/test/library-tests/semmle/go/Function/genericFunctions2.go b/go/ql/test/library-tests/semmle/go/Function/genericFunctions2.go index 9394357dea01..a7c4f86786ee 100644 --- a/go/ql/test/library-tests/semmle/go/Function/genericFunctions2.go +++ b/go/ql/test/library-tests/semmle/go/Function/genericFunctions2.go @@ -1,6 +1,6 @@ package main -func GenericFunctionInAnotherFile[T any](t T) T { - var r T +func GenericFunctionInAnotherFile[TP200 any](t TP200) TP200 { + var r TP200 return r } diff --git a/go/ql/test/library-tests/semmle/go/Function/getParameter.expected b/go/ql/test/library-tests/semmle/go/Function/getParameter.expected index 80171d5e79a6..d3bfefa28d0b 100644 --- a/go/ql/test/library-tests/semmle/go/Function/getParameter.expected +++ b/go/ql/test/library-tests/semmle/go/Function/getParameter.expected @@ -1,16 +1,16 @@ -| genericFunctions2.go:3:6:3:33 | GenericFunctionInAnotherFile | 0 | genericFunctions2.go:3:42:3:42 | t | -| genericFunctions.go:9:6:9:32 | GenericFunctionOneTypeParam | 0 | genericFunctions.go:9:41:9:41 | t | -| genericFunctions.go:15:6:15:33 | GenericFunctionTwoTypeParams | 0 | genericFunctions.go:15:68:15:68 | m | -| genericFunctions.go:87:30:87:31 | f1 | -1 | genericFunctions.go:87:7:87:7 | x | -| genericFunctions.go:92:31:92:32 | g1 | -1 | genericFunctions.go:92:7:92:7 | x | -| genericFunctions.go:95:35:95:36 | f2 | -1 | genericFunctions.go:95:7:95:7 | x | -| genericFunctions.go:98:36:98:37 | g2 | -1 | genericFunctions.go:98:7:98:7 | x | -| genericFunctions.go:120:19:120:23 | MyLen | -1 | genericFunctions.go:120:7:120:7 | l | -| genericFunctions.go:134:6:134:8 | New | 0 | genericFunctions.go:134:64:134:68 | nodes | -| genericFunctions.go:138:29:138:40 | ShortestPath | 0 | genericFunctions.go:138:42:138:45 | from | -| genericFunctions.go:138:29:138:40 | ShortestPath | 1 | genericFunctions.go:138:48:138:49 | to | -| genericFunctions.go:138:29:138:40 | ShortestPath | -1 | genericFunctions.go:138:7:138:7 | g | -| genericFunctions.go:154:51:154:51 | f | -1 | genericFunctions.go:154:7:154:7 | x | +| genericFunctions2.go:3:6:3:33 | GenericFunctionInAnotherFile | 0 | genericFunctions2.go:3:46:3:46 | t | +| genericFunctions.go:11:6:11:32 | GenericFunctionOneTypeParam | 0 | genericFunctions.go:11:45:11:45 | t | +| genericFunctions.go:17:6:17:33 | GenericFunctionTwoTypeParams | 0 | genericFunctions.go:17:76:17:76 | m | +| genericFunctions.go:95:32:95:33 | f1 | -1 | genericFunctions.go:95:7:95:7 | x | +| genericFunctions.go:100:33:100:34 | g1 | -1 | genericFunctions.go:100:7:100:7 | x | +| genericFunctions.go:103:39:103:40 | f2 | -1 | genericFunctions.go:103:7:103:7 | x | +| genericFunctions.go:106:40:106:41 | g2 | -1 | genericFunctions.go:106:7:106:7 | x | +| genericFunctions.go:128:23:128:27 | MyLen | -1 | genericFunctions.go:128:7:128:7 | l | +| genericFunctions.go:142:6:142:8 | New | 0 | genericFunctions.go:142:68:142:72 | nodes | +| genericFunctions.go:146:31:146:42 | ShortestPath | 0 | genericFunctions.go:146:44:146:47 | from | +| genericFunctions.go:146:31:146:42 | ShortestPath | 1 | genericFunctions.go:146:50:146:51 | to | +| genericFunctions.go:146:31:146:42 | ShortestPath | -1 | genericFunctions.go:146:7:146:7 | g | +| genericFunctions.go:162:51:162:51 | f | -1 | genericFunctions.go:162:7:162:7 | x | | main.go:7:6:7:7 | f1 | 0 | main.go:7:9:7:9 | x | | main.go:9:12:9:13 | f2 | 0 | main.go:9:15:9:15 | x | | main.go:9:12:9:13 | f2 | 1 | main.go:9:18:9:18 | y | diff --git a/go/ql/test/library-tests/semmle/go/Function/getTypeParameter.expected b/go/ql/test/library-tests/semmle/go/Function/getTypeParameter.expected index 27a89adf95e2..e4cfa8faa18e 100644 --- a/go/ql/test/library-tests/semmle/go/Function/getTypeParameter.expected +++ b/go/ql/test/library-tests/semmle/go/Function/getTypeParameter.expected @@ -1,21 +1,21 @@ -| genericFunctions2.go:3:1:6:1 | function declaration | FuncDecl | 0 | genericFunctions2.go:3:35:3:39 | type parameter declaration | 0 | genericFunctions2.go:3:35:3:35 | T | genericFunctions2.go:3:37:3:39 | any | interface { } | -| genericFunctions.go:9:1:12:1 | function declaration | FuncDecl | 0 | genericFunctions.go:9:34:9:38 | type parameter declaration | 0 | genericFunctions.go:9:34:9:34 | T | genericFunctions.go:9:36:9:38 | any | interface { } | -| genericFunctions.go:15:1:21:1 | function declaration | FuncDecl | 0 | genericFunctions.go:15:35:15:46 | type parameter declaration | 0 | genericFunctions.go:15:35:15:35 | K | genericFunctions.go:15:37:15:46 | comparable | comparable | -| genericFunctions.go:15:1:21:1 | function declaration | FuncDecl | 1 | genericFunctions.go:15:49:15:65 | type parameter declaration | 0 | genericFunctions.go:15:49:15:49 | V | genericFunctions.go:15:51:15:65 | type set literal | interface { int64 \| float64 } | -| genericFunctions.go:81:6:82:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:81:21:81:25 | type parameter declaration | 0 | genericFunctions.go:81:21:81:21 | T | genericFunctions.go:81:23:81:25 | any | interface { } | -| genericFunctions.go:84:6:85:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:84:21:84:28 | type parameter declaration | 0 | genericFunctions.go:84:21:84:21 | S | genericFunctions.go:84:26:84:28 | any | interface { } | -| genericFunctions.go:84:6:85:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:84:21:84:28 | type parameter declaration | 1 | genericFunctions.go:84:24:84:24 | T | genericFunctions.go:84:26:84:28 | any | interface { } | -| genericFunctions.go:111:6:113:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:111:14:111:18 | type parameter declaration | 0 | genericFunctions.go:111:14:111:14 | S | genericFunctions.go:111:16:111:18 | any | interface { } | -| genericFunctions.go:115:6:117:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:115:11:115:15 | type parameter declaration | 0 | genericFunctions.go:115:11:115:11 | T | genericFunctions.go:115:13:115:15 | any | interface { } | -| genericFunctions.go:124:6:126:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:124:21:124:28 | type parameter declaration | 0 | genericFunctions.go:124:21:124:24 | Edge | genericFunctions.go:124:26:124:28 | any | interface { } | -| genericFunctions.go:128:6:130:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:128:21:128:28 | type parameter declaration | 0 | genericFunctions.go:128:21:128:24 | Node | genericFunctions.go:128:26:128:28 | any | interface { } | -| genericFunctions.go:132:6:132:73 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:132:12:132:36 | type parameter declaration | 0 | genericFunctions.go:132:12:132:15 | Node | genericFunctions.go:132:17:132:36 | generic type instantiation expression | NodeConstraint | -| genericFunctions.go:132:6:132:73 | type declaration specifier | TypeSpec | 1 | genericFunctions.go:132:39:132:63 | type parameter declaration | 0 | genericFunctions.go:132:39:132:42 | Edge | genericFunctions.go:132:44:132:63 | generic type instantiation expression | EdgeConstraint | -| genericFunctions.go:134:1:136:1 | function declaration | FuncDecl | 0 | genericFunctions.go:134:10:134:34 | type parameter declaration | 0 | genericFunctions.go:134:10:134:13 | Node | genericFunctions.go:134:15:134:34 | generic type instantiation expression | NodeConstraint | -| genericFunctions.go:134:1:136:1 | function declaration | FuncDecl | 1 | genericFunctions.go:134:37:134:61 | type parameter declaration | 0 | genericFunctions.go:134:37:134:40 | Edge | genericFunctions.go:134:42:134:61 | generic type instantiation expression | EdgeConstraint | -| genericFunctions.go:150:1:150:65 | function declaration | FuncDecl | 0 | genericFunctions.go:150:38:150:42 | type parameter declaration | 0 | genericFunctions.go:150:38:150:38 | _ | genericFunctions.go:150:40:150:42 | any | interface { } | -| genericFunctions.go:150:1:150:65 | function declaration | FuncDecl | 1 | genericFunctions.go:150:45:150:52 | type parameter declaration | 0 | genericFunctions.go:150:45:150:45 | _ | genericFunctions.go:150:47:150:52 | string | interface { string } | -| genericFunctions.go:150:1:150:65 | function declaration | FuncDecl | 2 | genericFunctions.go:150:55:150:59 | type parameter declaration | 0 | genericFunctions.go:150:55:150:55 | _ | genericFunctions.go:150:57:150:59 | any | interface { } | -| genericFunctions.go:152:6:152:69 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:152:38:152:42 | type parameter declaration | 0 | genericFunctions.go:152:38:152:38 | _ | genericFunctions.go:152:40:152:42 | any | interface { } | -| genericFunctions.go:152:6:152:69 | type declaration specifier | TypeSpec | 1 | genericFunctions.go:152:45:152:52 | type parameter declaration | 0 | genericFunctions.go:152:45:152:45 | _ | genericFunctions.go:152:47:152:52 | string | interface { string } | -| genericFunctions.go:152:6:152:69 | type declaration specifier | TypeSpec | 2 | genericFunctions.go:152:55:152:59 | type parameter declaration | 0 | genericFunctions.go:152:55:152:55 | _ | genericFunctions.go:152:57:152:59 | any | interface { } | +| genericFunctions2.go:3:1:6:1 | function declaration | FuncDecl | 0 | genericFunctions2.go:3:35:3:43 | type parameter declaration | 0 | genericFunctions2.go:3:35:3:39 | TP200 | genericFunctions2.go:3:41:3:43 | any | any | +| genericFunctions.go:11:1:14:1 | function declaration | FuncDecl | 0 | genericFunctions.go:11:34:11:42 | type parameter declaration | 0 | genericFunctions.go:11:34:11:38 | TP101 | genericFunctions.go:11:40:11:42 | any | any | +| genericFunctions.go:17:1:23:1 | function declaration | FuncDecl | 0 | genericFunctions.go:17:35:17:50 | type parameter declaration | 0 | genericFunctions.go:17:35:17:39 | TP102 | genericFunctions.go:17:41:17:50 | comparable | comparable | +| genericFunctions.go:17:1:23:1 | function declaration | FuncDecl | 1 | genericFunctions.go:17:53:17:73 | type parameter declaration | 0 | genericFunctions.go:17:53:17:57 | TP103 | genericFunctions.go:17:59:17:73 | type set literal | interface { int64 \| float64 } | +| genericFunctions.go:89:6:90:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:89:21:89:37 | type parameter declaration | 0 | genericFunctions.go:89:21:89:25 | TP104 | genericFunctions.go:89:27:89:37 | interface type | interface { } | +| genericFunctions.go:92:6:93:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:92:21:92:36 | type parameter declaration | 0 | genericFunctions.go:92:21:92:25 | TP105 | genericFunctions.go:92:34:92:36 | any | any | +| genericFunctions.go:92:6:93:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:92:21:92:36 | type parameter declaration | 1 | genericFunctions.go:92:28:92:32 | TP106 | genericFunctions.go:92:34:92:36 | any | any | +| genericFunctions.go:119:6:121:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:119:14:119:22 | type parameter declaration | 0 | genericFunctions.go:119:14:119:18 | TP113 | genericFunctions.go:119:20:119:22 | any | any | +| genericFunctions.go:123:6:125:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:123:11:123:19 | type parameter declaration | 0 | genericFunctions.go:123:11:123:15 | TP114 | genericFunctions.go:123:17:123:19 | any | any | +| genericFunctions.go:132:6:134:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:132:21:132:29 | type parameter declaration | 0 | genericFunctions.go:132:21:132:25 | TP116 | genericFunctions.go:132:27:132:29 | any | any | +| genericFunctions.go:136:6:138:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:136:21:136:29 | type parameter declaration | 0 | genericFunctions.go:136:21:136:25 | TP117 | genericFunctions.go:136:27:136:29 | any | any | +| genericFunctions.go:140:6:140:77 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:140:12:140:38 | type parameter declaration | 0 | genericFunctions.go:140:12:140:16 | TP118 | genericFunctions.go:140:18:140:38 | generic type instantiation expression | NodeConstraint | +| genericFunctions.go:140:6:140:77 | type declaration specifier | TypeSpec | 1 | genericFunctions.go:140:41:140:67 | type parameter declaration | 0 | genericFunctions.go:140:41:140:45 | TP119 | genericFunctions.go:140:47:140:67 | generic type instantiation expression | EdgeConstraint | +| genericFunctions.go:142:1:144:1 | function declaration | FuncDecl | 0 | genericFunctions.go:142:10:142:36 | type parameter declaration | 0 | genericFunctions.go:142:10:142:14 | TP120 | genericFunctions.go:142:16:142:36 | generic type instantiation expression | NodeConstraint | +| genericFunctions.go:142:1:144:1 | function declaration | FuncDecl | 1 | genericFunctions.go:142:39:142:65 | type parameter declaration | 0 | genericFunctions.go:142:39:142:43 | TP121 | genericFunctions.go:142:45:142:65 | generic type instantiation expression | EdgeConstraint | +| genericFunctions.go:158:1:158:65 | function declaration | FuncDecl | 0 | genericFunctions.go:158:38:158:42 | type parameter declaration | 0 | genericFunctions.go:158:38:158:38 | _ | genericFunctions.go:158:40:158:42 | any | any | +| genericFunctions.go:158:1:158:65 | function declaration | FuncDecl | 1 | genericFunctions.go:158:45:158:52 | type parameter declaration | 0 | genericFunctions.go:158:45:158:45 | _ | genericFunctions.go:158:47:158:52 | string | interface { string } | +| genericFunctions.go:158:1:158:65 | function declaration | FuncDecl | 2 | genericFunctions.go:158:55:158:59 | type parameter declaration | 0 | genericFunctions.go:158:55:158:55 | _ | genericFunctions.go:158:57:158:59 | any | any | +| genericFunctions.go:160:6:160:69 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:160:38:160:42 | type parameter declaration | 0 | genericFunctions.go:160:38:160:38 | _ | genericFunctions.go:160:40:160:42 | any | any | +| genericFunctions.go:160:6:160:69 | type declaration specifier | TypeSpec | 1 | genericFunctions.go:160:45:160:52 | type parameter declaration | 0 | genericFunctions.go:160:45:160:45 | _ | genericFunctions.go:160:47:160:52 | string | interface { string } | +| genericFunctions.go:160:6:160:69 | type declaration specifier | TypeSpec | 2 | genericFunctions.go:160:55:160:59 | type parameter declaration | 0 | genericFunctions.go:160:55:160:55 | _ | genericFunctions.go:160:57:160:59 | any | any | diff --git a/go/ql/test/library-tests/semmle/go/PrintAst/PrintAst.expected b/go/ql/test/library-tests/semmle/go/PrintAst/PrintAst.expected index 66aa26430633..09bbe822587c 100644 --- a/go/ql/test/library-tests/semmle/go/PrintAst/PrintAst.expected +++ b/go/ql/test/library-tests/semmle/go/PrintAst/PrintAst.expected @@ -53,10 +53,10 @@ input.go: # 20| 0: [CallExpr] call to Println # 20| Type = (int, error) # 20| 0: [FunctionName, SelectorExpr] selection of Println -# 20| Type = func(...interface { }) int, error +# 20| Type = func(...any) int, error # 20| 0: [Ident, PackageName] fmt # 20| 1: [FunctionName, Ident] Println -# 20| Type = func(...interface { }) int, error +# 20| Type = func(...any) int, error # 20| 1: [StringLit] "Hi" # 20| Type = string # 20| Value = [StringLit] Hi @@ -203,10 +203,10 @@ input.go: # 52| 0: [CallExpr] call to Println # 52| Type = (int, error) # 52| 0: [FunctionName, SelectorExpr] selection of Println -# 52| Type = func(...interface { }) int, error +# 52| Type = func(...any) int, error # 52| 0: [Ident, PackageName] fmt # 52| 1: [FunctionName, Ident] Println -# 52| Type = func(...interface { }) int, error +# 52| Type = func(...any) int, error # 52| 1: [StringLit] "Heard from ch1" # 52| Type = string # 52| Value = [StringLit] Heard from ch1 @@ -229,20 +229,20 @@ input.go: # 54| 0: [CallExpr] call to Println # 54| Type = (int, error) # 54| 0: [FunctionName, SelectorExpr] selection of Println -# 54| Type = func(...interface { }) int, error +# 54| Type = func(...any) int, error # 54| 0: [Ident, PackageName] fmt # 54| 1: [FunctionName, Ident] Println -# 54| Type = func(...interface { }) int, error +# 54| Type = func(...any) int, error # 54| 1: [Ident, VariableName] a # 54| Type = [1]float32 # 55| 2: [ExprStmt] expression statement # 55| 0: [CallExpr] call to Println # 55| Type = (int, error) # 55| 0: [FunctionName, SelectorExpr] selection of Println -# 55| Type = func(...interface { }) int, error +# 55| Type = func(...any) int, error # 55| 0: [Ident, PackageName] fmt # 55| 1: [FunctionName, Ident] Println -# 55| Type = func(...interface { }) int, error +# 55| Type = func(...any) int, error # 55| 1: [Ident, VariableName] w # 55| Type = bool # 56| 2: [CommClause] comm clause @@ -250,10 +250,10 @@ input.go: # 57| 0: [CallExpr] call to Println # 57| Type = (int, error) # 57| 0: [FunctionName, SelectorExpr] selection of Println -# 57| Type = func(...interface { }) int, error +# 57| Type = func(...any) int, error # 57| 0: [Ident, PackageName] fmt # 57| 1: [FunctionName, Ident] Println -# 57| Type = func(...interface { }) int, error +# 57| Type = func(...any) int, error # 58| 3: [CommClause] comm clause # 58| 0: [SendStmt] send statement # 58| 0: [Ident, VariableName] ch1 @@ -297,10 +297,10 @@ input.go: # 67| 0: [CallExpr] call to Println # 67| Type = (int, error) # 67| 0: [FunctionName, SelectorExpr] selection of Println -# 67| Type = func(...interface { }) int, error +# 67| Type = func(...any) int, error # 67| 0: [Ident, PackageName] fmt # 67| 1: [FunctionName, Ident] Println -# 67| Type = func(...interface { }) int, error +# 67| Type = func(...any) int, error # 67| 1: [Ident, VariableName] x # 67| Type = int # 68| 2: [BlockStmt] block statement @@ -316,10 +316,10 @@ input.go: # 69| 0: [CallExpr] call to Println # 69| Type = (int, error) # 69| 0: [FunctionName, SelectorExpr] selection of Println -# 69| Type = func(...interface { }) int, error +# 69| Type = func(...any) int, error # 69| 0: [Ident, PackageName] fmt # 69| 1: [FunctionName, Ident] Println -# 69| Type = func(...interface { }) int, error +# 69| Type = func(...any) int, error # 69| 1: [MinusExpr] -... # 69| Type = int # 69| 0: [Ident, VariableName] x @@ -474,10 +474,10 @@ input.go: # 115| 0: [CallExpr] call to Println # 115| Type = (int, error) # 115| 0: [FunctionName, SelectorExpr] selection of Println -# 115| Type = func(...interface { }) int, error +# 115| Type = func(...any) int, error # 115| 0: [Ident, PackageName] fmt # 115| 1: [FunctionName, Ident] Println -# 115| Type = func(...interface { }) int, error +# 115| Type = func(...any) int, error # 115| 1: [Ident, VariableName] y # 115| Type = interface { } # 116| 1: [CaseClause] case clause @@ -566,10 +566,10 @@ input.go: # 138| 0: [CallExpr] call to Print # 138| Type = (int, error) # 138| 0: [FunctionName, SelectorExpr] selection of Print -# 138| Type = func(...interface { }) int, error +# 138| Type = func(...any) int, error # 138| 0: [Ident, PackageName] fmt # 138| 1: [FunctionName, Ident] Print -# 138| Type = func(...interface { }) int, error +# 138| Type = func(...any) int, error # 138| 1: [Ident, VariableName] x # 138| Type = int # 141| 1: [RangeStmt] range statement @@ -584,10 +584,10 @@ input.go: # 142| 0: [CallExpr] call to Print # 142| Type = (int, error) # 142| 0: [FunctionName, SelectorExpr] selection of Print -# 142| Type = func(...interface { }) int, error +# 142| Type = func(...any) int, error # 142| 0: [Ident, PackageName] fmt # 142| 1: [FunctionName, Ident] Print -# 142| Type = func(...interface { }) int, error +# 142| Type = func(...any) int, error # 142| 1: [Ident, VariableName] i # 142| Type = int # 142| 2: [Ident, VariableName] v diff --git a/go/ql/test/library-tests/semmle/go/PrintAst/PrintAstExcludeComments.expected b/go/ql/test/library-tests/semmle/go/PrintAst/PrintAstExcludeComments.expected index 099aa4e6144f..7885f9453c0e 100644 --- a/go/ql/test/library-tests/semmle/go/PrintAst/PrintAstExcludeComments.expected +++ b/go/ql/test/library-tests/semmle/go/PrintAst/PrintAstExcludeComments.expected @@ -33,10 +33,10 @@ input.go: # 20| 0: [CallExpr] call to Println # 20| Type = (int, error) # 20| 0: [FunctionName, SelectorExpr] selection of Println -# 20| Type = func(...interface { }) int, error +# 20| Type = func(...any) int, error # 20| 0: [Ident, PackageName] fmt # 20| 1: [FunctionName, Ident] Println -# 20| Type = func(...interface { }) int, error +# 20| Type = func(...any) int, error # 20| 1: [StringLit] "Hi" # 20| Type = string # 20| Value = [StringLit] Hi @@ -183,10 +183,10 @@ input.go: # 52| 0: [CallExpr] call to Println # 52| Type = (int, error) # 52| 0: [FunctionName, SelectorExpr] selection of Println -# 52| Type = func(...interface { }) int, error +# 52| Type = func(...any) int, error # 52| 0: [Ident, PackageName] fmt # 52| 1: [FunctionName, Ident] Println -# 52| Type = func(...interface { }) int, error +# 52| Type = func(...any) int, error # 52| 1: [StringLit] "Heard from ch1" # 52| Type = string # 52| Value = [StringLit] Heard from ch1 @@ -209,20 +209,20 @@ input.go: # 54| 0: [CallExpr] call to Println # 54| Type = (int, error) # 54| 0: [FunctionName, SelectorExpr] selection of Println -# 54| Type = func(...interface { }) int, error +# 54| Type = func(...any) int, error # 54| 0: [Ident, PackageName] fmt # 54| 1: [FunctionName, Ident] Println -# 54| Type = func(...interface { }) int, error +# 54| Type = func(...any) int, error # 54| 1: [Ident, VariableName] a # 54| Type = [1]float32 # 55| 2: [ExprStmt] expression statement # 55| 0: [CallExpr] call to Println # 55| Type = (int, error) # 55| 0: [FunctionName, SelectorExpr] selection of Println -# 55| Type = func(...interface { }) int, error +# 55| Type = func(...any) int, error # 55| 0: [Ident, PackageName] fmt # 55| 1: [FunctionName, Ident] Println -# 55| Type = func(...interface { }) int, error +# 55| Type = func(...any) int, error # 55| 1: [Ident, VariableName] w # 55| Type = bool # 56| 2: [CommClause] comm clause @@ -230,10 +230,10 @@ input.go: # 57| 0: [CallExpr] call to Println # 57| Type = (int, error) # 57| 0: [FunctionName, SelectorExpr] selection of Println -# 57| Type = func(...interface { }) int, error +# 57| Type = func(...any) int, error # 57| 0: [Ident, PackageName] fmt # 57| 1: [FunctionName, Ident] Println -# 57| Type = func(...interface { }) int, error +# 57| Type = func(...any) int, error # 58| 3: [CommClause] comm clause # 58| 0: [SendStmt] send statement # 58| 0: [Ident, VariableName] ch1 @@ -277,10 +277,10 @@ input.go: # 67| 0: [CallExpr] call to Println # 67| Type = (int, error) # 67| 0: [FunctionName, SelectorExpr] selection of Println -# 67| Type = func(...interface { }) int, error +# 67| Type = func(...any) int, error # 67| 0: [Ident, PackageName] fmt # 67| 1: [FunctionName, Ident] Println -# 67| Type = func(...interface { }) int, error +# 67| Type = func(...any) int, error # 67| 1: [Ident, VariableName] x # 67| Type = int # 68| 2: [BlockStmt] block statement @@ -296,10 +296,10 @@ input.go: # 69| 0: [CallExpr] call to Println # 69| Type = (int, error) # 69| 0: [FunctionName, SelectorExpr] selection of Println -# 69| Type = func(...interface { }) int, error +# 69| Type = func(...any) int, error # 69| 0: [Ident, PackageName] fmt # 69| 1: [FunctionName, Ident] Println -# 69| Type = func(...interface { }) int, error +# 69| Type = func(...any) int, error # 69| 1: [MinusExpr] -... # 69| Type = int # 69| 0: [Ident, VariableName] x @@ -454,10 +454,10 @@ input.go: # 115| 0: [CallExpr] call to Println # 115| Type = (int, error) # 115| 0: [FunctionName, SelectorExpr] selection of Println -# 115| Type = func(...interface { }) int, error +# 115| Type = func(...any) int, error # 115| 0: [Ident, PackageName] fmt # 115| 1: [FunctionName, Ident] Println -# 115| Type = func(...interface { }) int, error +# 115| Type = func(...any) int, error # 115| 1: [Ident, VariableName] y # 115| Type = interface { } # 116| 1: [CaseClause] case clause @@ -546,10 +546,10 @@ input.go: # 138| 0: [CallExpr] call to Print # 138| Type = (int, error) # 138| 0: [FunctionName, SelectorExpr] selection of Print -# 138| Type = func(...interface { }) int, error +# 138| Type = func(...any) int, error # 138| 0: [Ident, PackageName] fmt # 138| 1: [FunctionName, Ident] Print -# 138| Type = func(...interface { }) int, error +# 138| Type = func(...any) int, error # 138| 1: [Ident, VariableName] x # 138| Type = int # 141| 1: [RangeStmt] range statement @@ -564,10 +564,10 @@ input.go: # 142| 0: [CallExpr] call to Print # 142| Type = (int, error) # 142| 0: [FunctionName, SelectorExpr] selection of Print -# 142| Type = func(...interface { }) int, error +# 142| Type = func(...any) int, error # 142| 0: [Ident, PackageName] fmt # 142| 1: [FunctionName, Ident] Print -# 142| Type = func(...interface { }) int, error +# 142| Type = func(...any) int, error # 142| 1: [Ident, VariableName] i # 142| Type = int # 142| 2: [Ident, VariableName] v diff --git a/go/ql/test/library-tests/semmle/go/Types/Aliases.expected b/go/ql/test/library-tests/semmle/go/Types/Aliases.expected index 2c09dd790a56..0a97495cfa83 100644 --- a/go/ql/test/library-tests/semmle/go/Types/Aliases.expected +++ b/go/ql/test/library-tests/semmle/go/Types/Aliases.expected @@ -1,20 +1,20 @@ entities -| aliases.go | aliases.go:3:6:3:13 | aliasesX | 1 | file://:0:0:0:0 | int | -| aliases.go | aliases.go:4:6:4:13 | aliasesY | 1 | file://:0:0:0:0 | int | -| aliases.go | aliases.go:6:6:6:14 | aliasesS1 | 1 | file://:0:0:0:0 | struct type | -| aliases.go | aliases.go:6:26:6:26 | x | 3 | file://:0:0:0:0 | int | -| aliases.go | aliases.go:8:6:8:14 | aliasesS2 | 1 | file://:0:0:0:0 | struct type | -| aliases.go | aliases.go:8:26:8:26 | x | 3 | file://:0:0:0:0 | int | +| aliases.go | aliases.go:3:6:3:13 | aliasesX | 1 | aliases.go:3:6:3:13 | aliasesX | +| aliases.go | aliases.go:4:6:4:13 | aliasesY | 1 | aliases.go:4:6:4:13 | aliasesY | +| aliases.go | aliases.go:6:6:6:14 | aliasesS1 | 1 | aliases.go:6:6:6:14 | aliasesS1 | +| aliases.go | aliases.go:6:26:6:26 | x | 1 | aliases.go:3:6:3:13 | aliasesX | +| aliases.go | aliases.go:8:6:8:14 | aliasesS2 | 1 | aliases.go:8:6:8:14 | aliasesS2 | +| aliases.go | aliases.go:8:26:8:26 | x | 1 | aliases.go:4:6:4:13 | aliasesY | | aliases.go | aliases.go:10:6:10:6 | F | 1 | file://:0:0:0:0 | signature type | -| aliases.go | aliases.go:10:8:10:11 | Afs1 | 1 | file://:0:0:0:0 | struct type | +| aliases.go | aliases.go:10:8:10:11 | Afs1 | 1 | aliases.go:6:6:6:14 | aliasesS1 | | aliases.go | aliases.go:14:6:14:6 | G | 1 | file://:0:0:0:0 | signature type | -| aliases.go | aliases.go:14:8:14:11 | Afs2 | 1 | file://:0:0:0:0 | struct type | +| aliases.go | aliases.go:14:8:14:11 | Afs2 | 1 | aliases.go:8:6:8:14 | aliasesS2 | | aliases.go | aliases.go:19:6:19:7 | S3 | 1 | aliases.go:19:6:19:7 | S3 | -| aliases.go | aliases.go:19:17:19:17 | x | 3 | file://:0:0:0:0 | int | -| aliases.go | aliases.go:22:6:22:6 | T | 1 | aliases.go:19:6:19:7 | S3 | +| aliases.go | aliases.go:19:17:19:17 | x | 1 | file://:0:0:0:0 | int | +| aliases.go | aliases.go:22:6:22:6 | T | 1 | aliases.go:22:6:22:6 | T | | aliases.go | aliases.go:25:6:25:6 | H | 1 | file://:0:0:0:0 | signature type | -| aliases.go | aliases.go:25:8:25:11 | Afs3 | 1 | aliases.go:19:6:19:7 | S3 | +| aliases.go | aliases.go:25:8:25:11 | Afs3 | 1 | aliases.go:22:6:22:6 | T | #select -| F | func(struct { x int }) int | -| G | func(struct { x int }) int | -| H | func(S3) int | +| F | func(aliasesS1) int | +| G | func(aliasesS2) int | +| H | func(T) int | diff --git a/go/ql/test/library-tests/semmle/go/Types/Field_hasQualifiedName2.expected b/go/ql/test/library-tests/semmle/go/Types/Field_hasQualifiedName2.expected index e7ffe6bc1ba6..c202f19c737f 100644 --- a/go/ql/test/library-tests/semmle/go/Types/Field_hasQualifiedName2.expected +++ b/go/ql/test/library-tests/semmle/go/Types/Field_hasQualifiedName2.expected @@ -1,6 +1,7 @@ -| aliases.go:6:26:6:26 | x | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.S3 | x | -| aliases.go:8:26:8:26 | x | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.S3 | x | +| aliases.go:6:26:6:26 | x | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.aliasesS1 | x | +| aliases.go:8:26:8:26 | x | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.aliasesS2 | x | | aliases.go:19:17:19:17 | x | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.S3 | x | +| aliases.go:19:17:19:17 | x | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.T | x | | cyclic.go:4:3:4:3 | s | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.s | s | | cyclic.go:8:3:8:3 | u | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.t | u | | cyclic.go:8:3:8:3 | u | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.u | u | diff --git a/go/ql/test/library-tests/semmle/go/Types/Field_hasQualifiedName3.expected b/go/ql/test/library-tests/semmle/go/Types/Field_hasQualifiedName3.expected index 03b93b37c747..4fdb1832707c 100644 --- a/go/ql/test/library-tests/semmle/go/Types/Field_hasQualifiedName3.expected +++ b/go/ql/test/library-tests/semmle/go/Types/Field_hasQualifiedName3.expected @@ -1,6 +1,7 @@ -| aliases.go:6:26:6:26 | x | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types | S3 | x | -| aliases.go:8:26:8:26 | x | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types | S3 | x | +| aliases.go:6:26:6:26 | x | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types | aliasesS1 | x | +| aliases.go:8:26:8:26 | x | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types | aliasesS2 | x | | aliases.go:19:17:19:17 | x | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types | S3 | x | +| aliases.go:19:17:19:17 | x | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types | T | x | | cyclic.go:4:3:4:3 | s | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types | s | s | | cyclic.go:8:3:8:3 | u | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types | t | u | | cyclic.go:8:3:8:3 | u | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types | u | u | diff --git a/go/ql/test/library-tests/semmle/go/Types/QualifiedNames.expected b/go/ql/test/library-tests/semmle/go/Types/QualifiedNames.expected index dd6e9021a4f3..78fbecb3389f 100644 --- a/go/ql/test/library-tests/semmle/go/Types/QualifiedNames.expected +++ b/go/ql/test/library-tests/semmle/go/Types/QualifiedNames.expected @@ -1,4 +1,9 @@ +| aliases.go:3:6:3:13 | aliasesX | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.aliasesX | +| aliases.go:4:6:4:13 | aliasesY | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.aliasesY | +| aliases.go:6:6:6:14 | aliasesS1 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.aliasesS1 | +| aliases.go:8:6:8:14 | aliasesS2 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.aliasesS2 | | aliases.go:19:6:19:7 | S3 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.S3 | +| aliases.go:22:6:22:6 | T | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.T | | cyclic.go:3:6:3:6 | s | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.s | | cyclic.go:7:6:7:6 | t | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.t | | cyclic.go:12:6:12:6 | u | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.u | @@ -30,7 +35,9 @@ | generic.go:47:6:47:16 | MyInterface | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.MyInterface | | generic.go:67:6:67:22 | HasBlankTypeParam | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.HasBlankTypeParam | | generic.go:68:6:68:23 | HasBlankTypeParams | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.HasBlankTypeParams | +| generic.go:82:6:82:14 | TypeAlias | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.TypeAlias | | generic.go:84:6:84:21 | GenericSignature | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.GenericSignature | +| generic.go:85:6:85:26 | GenericSignatureAlias | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.GenericSignatureAlias | | interface.go:3:6:3:7 | i0 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.i0 | | interface.go:5:6:5:7 | i1 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.i1 | | interface.go:9:6:9:7 | i2 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.i2 | diff --git a/go/ql/test/library-tests/semmle/go/Types/StructFields.expected b/go/ql/test/library-tests/semmle/go/Types/StructFields.expected index 1757e0cdaf95..f2281af978ff 100644 --- a/go/ql/test/library-tests/semmle/go/Types/StructFields.expected +++ b/go/ql/test/library-tests/semmle/go/Types/StructFields.expected @@ -1,5 +1,5 @@ -| aliases.go:19:6:19:7 | S3 | aliases.go:6:18:6:37 | struct type | x | int | -| aliases.go:19:6:19:7 | S3 | aliases.go:8:18:8:37 | struct type | x | int | +| aliases.go:19:6:19:7 | S3 | aliases.go:6:18:6:37 | struct type | x | aliasesX | +| aliases.go:19:6:19:7 | S3 | aliases.go:8:18:8:37 | struct type | x | aliasesY | | aliases.go:19:6:19:7 | S3 | aliases.go:19:9:19:23 | struct type | x | int | | cyclic.go:3:6:3:6 | s | cyclic.go:3:8:5:1 | struct type | s | * s | | cyclic.go:7:6:7:6 | t | cyclic.go:7:8:10:1 | struct type | f | int | diff --git a/go/ql/test/library-tests/semmle/go/Types/StructFields.ql b/go/ql/test/library-tests/semmle/go/Types/StructFields.ql index 0e0b93b230e3..52469731ddc5 100644 --- a/go/ql/test/library-tests/semmle/go/Types/StructFields.ql +++ b/go/ql/test/library-tests/semmle/go/Types/StructFields.ql @@ -2,6 +2,6 @@ import go from StructTypeExpr ste, NamedType named, string name, Type tp where - named.getUnderlyingType() = ste.getType() and + named.getUnderlyingType().getDeepUnaliasedType() = ste.getType().getDeepUnaliasedType() and ste.getType().(StructType).hasField(name, tp) select named, ste, name, tp.pp() diff --git a/go/ql/test/library-tests/semmle/go/Types/Types.expected b/go/ql/test/library-tests/semmle/go/Types/Types.expected index ab34dd4d8eef..d64daf5ab9af 100644 --- a/go/ql/test/library-tests/semmle/go/Types/Types.expected +++ b/go/ql/test/library-tests/semmle/go/Types/Types.expected @@ -1,4 +1,9 @@ +| aliases.go:3:6:3:13 | aliasesX | aliasesX | +| aliases.go:4:6:4:13 | aliasesY | aliasesY | +| aliases.go:6:6:6:14 | aliasesS1 | aliasesS1 | +| aliases.go:8:6:8:14 | aliasesS2 | aliasesS2 | | aliases.go:19:6:19:7 | S3 | S3 | +| aliases.go:22:6:22:6 | T | T | | cyclic.go:3:6:3:6 | s | s | | cyclic.go:7:6:7:6 | t | t | | cyclic.go:12:6:12:6 | u | u | @@ -30,7 +35,9 @@ | generic.go:47:6:47:16 | MyInterface | MyInterface | | generic.go:67:6:67:22 | HasBlankTypeParam | HasBlankTypeParam | | generic.go:68:6:68:23 | HasBlankTypeParams | HasBlankTypeParams | +| generic.go:82:6:82:14 | TypeAlias | TypeAlias | | generic.go:84:6:84:21 | GenericSignature | GenericSignature | +| generic.go:85:6:85:26 | GenericSignatureAlias | GenericSignatureAlias | | interface.go:3:6:3:7 | i0 | i0 | | interface.go:5:6:5:7 | i1 | i1 | | interface.go:9:6:9:7 | i2 | i2 | diff --git a/go/ql/test/library-tests/semmle/go/aliases/InterfaceImpls/test.expected b/go/ql/test/library-tests/semmle/go/aliases/InterfaceImpls/test.expected index 01635aaf19d4..4807588d4dbe 100644 --- a/go/ql/test/library-tests/semmle/go/aliases/InterfaceImpls/test.expected +++ b/go/ql/test/library-tests/semmle/go/aliases/InterfaceImpls/test.expected @@ -13,16 +13,16 @@ callTargets | test.go:57:2:57:29 | call to ImplementMe | test.go:46:1:46:87 | function declaration | ImplementMe | | test.go:57:2:57:29 | call to ImplementMe | test.go:53:1:53:85 | function declaration | ImplementMe | #select -| file://:0:0:0:0 | basic interface type | * Impl1 | -| file://:0:0:0:0 | basic interface type | * Impl2 | -| file://:0:0:0:0 | basic interface type | * Impl3 | -| file://:0:0:0:0 | basic interface type | * Impl4 | -| file://:0:0:0:0 | basic interface type | * Impl5 | -| file://:0:0:0:0 | basic interface type | * Impl6 | -| file://:0:0:0:0 | basic interface type | Impl1 | -| file://:0:0:0:0 | basic interface type | Impl2 | -| file://:0:0:0:0 | basic interface type | Impl3 | -| file://:0:0:0:0 | basic interface type | Impl4 | -| file://:0:0:0:0 | basic interface type | Impl5 | -| file://:0:0:0:0 | basic interface type | Impl6 | -| file://:0:0:0:0 | basic interface type | interface { ImplementMe func(func(struct { x int }) ) } | +| interface { ImplementMe func(func(struct { x int }) ) } | * Impl1 | +| interface { ImplementMe func(func(struct { x int }) ) } | * Impl2 | +| interface { ImplementMe func(func(struct { x int }) ) } | * Impl3 | +| interface { ImplementMe func(func(struct { x int }) ) } | * Impl4 | +| interface { ImplementMe func(func(struct { x int }) ) } | * Impl5 | +| interface { ImplementMe func(func(struct { x int }) ) } | * Impl6 | +| interface { ImplementMe func(func(struct { x int }) ) } | Impl1 | +| interface { ImplementMe func(func(struct { x int }) ) } | Impl2 | +| interface { ImplementMe func(func(struct { x int }) ) } | Impl3 | +| interface { ImplementMe func(func(struct { x int }) ) } | Impl4 | +| interface { ImplementMe func(func(struct { x int }) ) } | Impl5 | +| interface { ImplementMe func(func(struct { x int }) ) } | Impl6 | +| interface { ImplementMe func(func(struct { x int }) ) } | interface { ImplementMe func(func(struct { x int }) ) } | diff --git a/go/ql/test/library-tests/semmle/go/aliases/InterfaceImpls/test.ql b/go/ql/test/library-tests/semmle/go/aliases/InterfaceImpls/test.ql index 88b6f63a5d55..5e132a9487b2 100644 --- a/go/ql/test/library-tests/semmle/go/aliases/InterfaceImpls/test.ql +++ b/go/ql/test/library-tests/semmle/go/aliases/InterfaceImpls/test.ql @@ -7,5 +7,9 @@ query predicate callTargets(DataFlow::CallNode cn, FuncDef target, string target from InterfaceType i, Type impl where i.hasMethod("ImplementMe", _) and - impl.implements(i) -select i, impl.pp() + impl.implements(i) and + // Avoid duplicates caused by different types which are the same + // when you ignore aliases. + impl = impl.getDeepUnaliasedType() and + i = i.getDeepUnaliasedType() +select i.pp(), impl.pp() diff --git a/go/ql/test/library-tests/semmle/go/aliases/MethodDefs/test.expected b/go/ql/test/library-tests/semmle/go/aliases/MethodDefs/test.expected index 71cd13704370..83e097fcf6de 100644 --- a/go/ql/test/library-tests/semmle/go/aliases/MethodDefs/test.expected +++ b/go/ql/test/library-tests/semmle/go/aliases/MethodDefs/test.expected @@ -1,19 +1,19 @@ distinctDefinedFs -| 2 | +| 4 | declaredEntities | methods.go:5:6:5:13 | IntAlias (1 declaration sites) | | methods.go:7:6:7:7 | S1 (1 declaration sites) | -| methods.go:7:19:7:19 | x (2 declaration sites) | +| methods.go:7:19:7:19 | x (1 declaration sites) | | methods.go:8:6:8:7 | S2 (1 declaration sites) | -| methods.go:8:19:8:19 | x (2 declaration sites) | +| methods.go:8:19:8:19 | x (1 declaration sites) | | methods.go:10:6:10:7 | I1 (1 declaration sites) | -| methods.go:10:22:10:22 | F (2 declaration sites) | +| methods.go:10:22:10:22 | F (1 declaration sites) | | methods.go:11:6:11:7 | I2 (1 declaration sites) | -| methods.go:11:22:11:22 | F (2 declaration sites) | +| methods.go:11:22:11:22 | F (1 declaration sites) | | methods.go:12:6:12:7 | I3 (1 declaration sites) | -| methods.go:12:22:12:22 | F (2 declaration sites) | +| methods.go:12:22:12:22 | F (1 declaration sites) | | methods.go:13:6:13:7 | I4 (1 declaration sites) | -| methods.go:13:22:13:22 | F (2 declaration sites) | +| methods.go:13:22:13:22 | F (1 declaration sites) | | methods.go:15:6:15:10 | Test1 (1 declaration sites) | | methods.go:15:12:15:17 | param1 (1 declaration sites) | | methods.go:15:23:15:28 | param2 (1 declaration sites) | diff --git a/go/ql/test/library-tests/semmle/go/aliases/defsuses/test.expected b/go/ql/test/library-tests/semmle/go/aliases/defsuses/test.expected index aa9c3ef213a8..7fd98f92adc2 100644 --- a/go/ql/test/library-tests/semmle/go/aliases/defsuses/test.expected +++ b/go/ql/test/library-tests/semmle/go/aliases/defsuses/test.expected @@ -1,11 +1,9 @@ lowLevelDefs | defsuses.go:6:6:6:13 | IntAlias | defsuses.go:6:6:6:13 | IntAlias (1 declaration sites) | | defsuses.go:8:6:8:7 | S1 | defsuses.go:8:6:8:7 | S1 (1 declaration sites) | -| defsuses.go:8:19:8:19 | x | defsuses.go:8:19:8:19 | x (2 declaration sites) | -| defsuses.go:8:19:8:19 | x | defsuses.go:9:19:9:19 | x (2 declaration sites) | +| defsuses.go:8:19:8:19 | x | defsuses.go:8:19:8:19 | x (1 declaration sites) | | defsuses.go:9:6:9:7 | S2 | defsuses.go:9:6:9:7 | S2 (1 declaration sites) | -| defsuses.go:9:19:9:19 | x | defsuses.go:8:19:8:19 | x (2 declaration sites) | -| defsuses.go:9:19:9:19 | x | defsuses.go:9:19:9:19 | x (2 declaration sites) | +| defsuses.go:9:19:9:19 | x | defsuses.go:9:19:9:19 | x (1 declaration sites) | | defsuses.go:11:6:11:10 | Test1 | defsuses.go:11:6:11:10 | Test1 (1 declaration sites) | | defsuses.go:12:2:12:4 | obj | defsuses.go:12:2:12:4 | obj (1 declaration sites) | | defsuses.go:15:6:15:8 | ptr | defsuses.go:15:6:15:8 | ptr (1 declaration sites) | @@ -16,18 +14,14 @@ lowLevelUses | defsuses.go:11:14:11:16 | int | file://:0:0:0:0 | int (0 declaration sites) | | defsuses.go:12:9:12:10 | S1 | defsuses.go:8:6:8:7 | S1 (1 declaration sites) | | defsuses.go:13:2:13:4 | obj | defsuses.go:12:2:12:4 | obj (1 declaration sites) | -| defsuses.go:13:6:13:6 | x | defsuses.go:8:19:8:19 | x (2 declaration sites) | -| defsuses.go:13:6:13:6 | x | defsuses.go:9:19:9:19 | x (2 declaration sites) | +| defsuses.go:13:6:13:6 | x | defsuses.go:8:19:8:19 | x (1 declaration sites) | | defsuses.go:15:11:15:12 | S2 | defsuses.go:9:6:9:7 | S2 (1 declaration sites) | | defsuses.go:16:2:16:4 | ptr | defsuses.go:15:6:15:8 | ptr (1 declaration sites) | | defsuses.go:16:9:16:11 | obj | defsuses.go:12:2:12:4 | obj (1 declaration sites) | | defsuses.go:18:9:18:11 | ptr | defsuses.go:15:6:15:8 | ptr (1 declaration sites) | -| defsuses.go:18:13:18:13 | x | defsuses.go:8:19:8:19 | x (2 declaration sites) | -| defsuses.go:18:13:18:13 | x | defsuses.go:9:19:9:19 | x (2 declaration sites) | +| defsuses.go:18:13:18:13 | x | defsuses.go:9:19:9:19 | x (1 declaration sites) | distinctDefinedXs -| 1 | +| 2 | distinctUsedXs -| 1 | +| 2 | fieldUseUsePairs -| defsuses.go:13:6:13:6 | x | defsuses.go:18:13:18:13 | x | -| defsuses.go:18:13:18:13 | x | defsuses.go:13:6:13:6 | x | diff --git a/go/size b/go/size new file mode 100644 index 000000000000..05cae77d9739 Binary files /dev/null and b/go/size differ