def get_intersection_type( types: Iterable[s_types.Type], *, ctx: context.ContextLevel, ) -> s_types.Type: ctx.env.schema, intersection, created = s_utils.ensure_intersection_type( ctx.env.schema, types) if created: ctx.env.created_schema_objects.add(intersection) elif (intersection not in ctx.env.created_schema_objects and intersection.get_name(ctx.env.schema).module != '__derived__'): ctx.env.schema_refs.add(intersection) return intersection
def get_intersection_type( types: Iterable[s_types.Type], *, ctx: context.ContextLevel, ) -> s_types.Type: ctx.env.schema, intersection, created = s_utils.ensure_intersection_type( ctx.env.schema, types) if created: ctx.env.created_schema_objects.add(intersection) elif (intersection not in ctx.env.created_schema_objects and (not isinstance(intersection, s_obj.QualifiedObject) or intersection.get_name(ctx.env.schema).module != '__derived__')): ctx.env.add_schema_ref(intersection, expr=None) return intersection