diff --git a/glean/glass/Glean/Glass/Pretty/Hack.hs b/glean/glass/Glean/Glass/Pretty/Hack.hs index c8e1a6537..697a0f315 100644 --- a/glean/glass/Glean/Glass/Pretty/Hack.hs +++ b/glean/glass/Glean/Glass/Pretty/Hack.hs @@ -779,7 +779,7 @@ toReifyKind Hack.ReifyKind_Erased = Erased toReifyKind (Hack.ReifyKind__UNKNOWN _) = Erased toConstraint :: Hack.Constraint -> Constraint -toConstraint (Hack.Constraint kind ty) = +toConstraint (Hack.Constraint kind ty _typeInfo) = Constraint (toConstraintKind kind) (toType $ Just ty) toConstraintKind :: Hack.ConstraintKind -> ConstraintKind diff --git a/glean/schema/cpp/schema.h b/glean/schema/cpp/schema.h index 9da0b7bfd..eed98e32d 100644 --- a/glean/schema/cpp/schema.h +++ b/glean/schema/cpp/schema.h @@ -11389,7 +11389,7 @@ namespace Hack { enum class TypeConstKind { Abstract, Concrete, PartiallyAbstract }; -struct TypeConstDefinition : Predicate, boost::variant>, Alt<1, Fact>>, TypeConstKind, std::vector>>> { +struct TypeConstDefinition : Predicate, boost::variant>, Alt<1, Fact>>, TypeConstKind, std::vector>, boost::variant>, Alt<1, Fact>>>> { static const char* GLEAN_name() { return "hack.TypeConstDefinition"; } @@ -11469,7 +11469,7 @@ struct QName : Predicate, boost::variant, boost::variant>, Alt<1, Fact>>, Visibility, bool, bool, bool, std::vector>>> { +struct PropertyDefinition : Predicate, boost::variant>, Alt<1, Fact>>, Visibility, bool, bool, bool, std::vector>, boost::variant>, Alt<1, Fact>>>> { static const char* GLEAN_name() { return "hack.PropertyDefinition"; } @@ -11757,7 +11757,7 @@ struct GlobalNamespaceAlias : Predicate, Fact, boost::variant>, Alt<1, Fact>>, std::string>> { +struct GlobalConstDefinition : Predicate, boost::variant>, Alt<1, Fact>>, std::string, boost::variant>, Alt<1, Fact>>>> { static const char* GLEAN_name() { return "hack.GlobalConstDefinition"; } @@ -11797,7 +11797,7 @@ struct Enumerator : Predicate, Fact>> { } }; // struct Enumerator -struct EnumDefinition : Predicate, Fact, boost::variant>, Alt<1, Fact>>, std::vector>, std::vector>, std::vector>, bool, boost::variant>, Alt<1, ModuleMembership>>>> { +struct EnumDefinition : Predicate, Fact, boost::variant>, Alt<1, Fact>>, boost::variant>, Alt<1, Fact>>, boost::variant>, Alt<1, Fact>>, std::vector>, std::vector>, std::vector>, bool, boost::variant>, Alt<1, ModuleMembership>>>> { static const char* GLEAN_name() { return "hack.EnumDefinition"; } @@ -12622,7 +12622,7 @@ enum class ConstraintKind { As, Equal, Super }; } // namespace schema template<> struct Repr_ { - using Type = Tuple, facebook::glean::cpp::schema::Hack::Type>; + using Type = Tuple, facebook::glean::cpp::schema::Hack::Type, Maybe>; }; @@ -12633,33 +12633,34 @@ namespace Hack { struct Constraint { ConstraintKind constraintKind; Fact type; + boost::variant>, Alt<1, Fact>> typeInfo; bool operator==(const Constraint& other) const { - return std::tie(constraintKind,type) - == std::tie(other.constraintKind,other.type); + return std::tie(constraintKind,type,typeInfo) + == std::tie(other.constraintKind,other.type,other.typeInfo); } bool operator!=(const Constraint& other) const { - return std::tie(constraintKind,type) - != std::tie(other.constraintKind,other.type); + return std::tie(constraintKind,type,typeInfo) + != std::tie(other.constraintKind,other.type,other.typeInfo); } bool operator<(const Constraint& other) const { - return std::tie(constraintKind,type) - < std::tie(other.constraintKind,other.type); + return std::tie(constraintKind,type,typeInfo) + < std::tie(other.constraintKind,other.type,other.typeInfo); } bool operator<=(const Constraint& other) const { - return std::tie(constraintKind,type) - <= std::tie(other.constraintKind,other.type); + return std::tie(constraintKind,type,typeInfo) + <= std::tie(other.constraintKind,other.type,other.typeInfo); } bool operator>(const Constraint& other) const { - return std::tie(constraintKind,type) - > std::tie(other.constraintKind,other.type); + return std::tie(constraintKind,type,typeInfo) + > std::tie(other.constraintKind,other.type,other.typeInfo); } bool operator>=(const Constraint& other) const { - return std::tie(constraintKind,type) - >= std::tie(other.constraintKind,other.type); + return std::tie(constraintKind,type,typeInfo) + >= std::tie(other.constraintKind,other.type,other.typeInfo); } void outputRepr(Output> out) const { - outputValue(out, std::make_tuple(constraintKind, type)); + outputValue(out, std::make_tuple(constraintKind, type, typeInfo)); } }; // struct Constraint @@ -12782,7 +12783,7 @@ struct ClassDeclaration : Predicate>> { } }; // struct ClassDeclaration -struct ClassConstDefinition : Predicate, boost::variant>, Alt<1, Fact>>, boost::variant>, Alt<1, std::string>>>> { +struct ClassConstDefinition : Predicate, boost::variant>, Alt<1, Fact>>, boost::variant>, Alt<1, std::string>>, boost::variant>, Alt<1, Fact>>>> { static const char* GLEAN_name() { return "hack.ClassConstDefinition"; } diff --git a/glean/schema/source/hack.angle b/glean/schema/source/hack.angle index 26e180bdd..473780ed2 100644 --- a/glean/schema/source/hack.angle +++ b/glean/schema/source/hack.angle @@ -82,7 +82,8 @@ type ConstraintKind = enum { As | Equal | Super } type Constraint = { constraintKind : ConstraintKind, - type: Type, + type: Type, # deprecated, replaced by TypeInfo + typeInfo: maybe TypeInfo } type ReadonlyKind = enum { Readonly } @@ -298,9 +299,11 @@ predicate TraitDefinition : predicate EnumDefinition : { declaration : EnumDeclaration, - enumBase: Type, + enumBase: Type, # deprecated, replaced by TypeInfo + enumBaseTypeInfo: maybe TypeInfo, # 'as' type; always nothing for enum classes enumConstraint: maybe Type, + enumConstraintTypeInfo: maybe TypeInfo, enumerators : [Enumerator], attributes : [UserAttribute], # uses for normal enums, and extends for enum classes @@ -345,6 +348,7 @@ predicate PropertyDefinition : isAbstract : bool, isStatic : bool, attributes : [UserAttribute], + typeInfo: maybe TypeInfo } # Definition of a Hack global (top-level) constant @@ -353,6 +357,7 @@ predicate GlobalConstDefinition : declaration : GlobalConstDeclaration, type : maybe Type, value : string, + typeInfo: maybe TypeInfo, } # Definition of a member constant @@ -362,6 +367,7 @@ predicate ClassConstDefinition : type : maybe Type, # A none/nothing value indicates an abstract const value : maybe string, + typeInfo: maybe TypeInfo } type TypeConstKind = enum { Abstract | Concrete | PartiallyAbstract } @@ -373,6 +379,7 @@ predicate TypeConstDefinition : type : maybe Type, kind : TypeConstKind, attributes : [UserAttribute], + typeInfo: maybe TypeInfo } # Definition of a Hack function