Skip to content

Commit

Permalink
Make overloading a link when omitting link keyword work (#6718)
Browse files Browse the repository at this point in the history
AlterUnknownPointer works by converting the AST node into an operation
on the relevant concrete pointer sort. It always converted into an
Alter, though, which meant that the overload case, where
AlterObject._cmd_tree_from_ast is called with a Create node, didn't
work right.

Fixes #6716.
  • Loading branch information
msullivan authored and aljazerzen committed Jan 25, 2024
1 parent ba1711e commit 0c24ca8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions edb/schema/unknown_pointers.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ def _cmd_tree_from_ast(
qlast.AlterConcreteProperty
if isinstance(obj, s_props.Property)
else qlast.AlterConcreteLink
) if isinstance(astnode, qlast.AlterObject) else (
qlast.CreateConcreteProperty
if isinstance(obj, s_props.Property)
else qlast.CreateConcreteLink
)
astnode = astnode.replace(__class__=astcls)
qlparser.append_module_aliases(astnode, context.modaliases)
Expand Down
21 changes: 21 additions & 0 deletions tests/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -10200,6 +10200,27 @@ def test_schema_describe_name_override_03(self):
"""
)

def test_schema_describe_overload_01(self):
self._assert_describe(
"""
abstract type Animal {
name: str;
parent: Animal;
}
type Human extending Animal {
overloaded parent: Human;
}
""",

'describe type test::Human as sdl',

"""
type test::Human extending test::Animal {
overloaded link parent: test::Human;
};
""",
)


class TestCreateMigration(tb.BaseSchemaTest):

Expand Down

0 comments on commit 0c24ca8

Please sign in to comment.