mirror of
https://github.com/github/codeql.git
synced 2026-05-01 19:55:15 +02:00
Codegen: disallow child on set properties
This commit is contained in:
@@ -8,6 +8,8 @@ class _ChildModifier(_schema.PropertyModifier):
|
||||
def modify(self, prop: _schema.Property):
|
||||
if prop.type is None or prop.type[0].islower():
|
||||
raise _schema.Error("Non-class properties cannot be children")
|
||||
if prop.is_unordered:
|
||||
raise _schema.Error("Set properties cannot be children")
|
||||
prop.is_child = True
|
||||
|
||||
|
||||
|
||||
@@ -259,8 +259,8 @@ def test_children():
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.parametrize("spec", [defs.string, defs.int, defs.boolean, defs.predicate])
|
||||
def test_builtin_and_predicate_children_not_allowed(spec):
|
||||
@pytest.mark.parametrize("spec", [defs.string, defs.int, defs.boolean, defs.predicate, defs.set["A"]])
|
||||
def test_builtin_predicate_and_set_children_not_allowed(spec):
|
||||
with pytest.raises(schema.Error):
|
||||
@load
|
||||
class data:
|
||||
|
||||
Reference in New Issue
Block a user