-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix typecheck error on atom negation with equivalent type (#2399)
- Loading branch information
Showing
7 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
tests/syntactic/equivalent_types_in_negation/equivalent_types_in_negation.dl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
.type List = [name: symbol, rest: List] | ||
.decl list_decl(l:List) | ||
list_decl(["A", ["B", ["C", nil]]]). | ||
list_decl(["D", ["E", ["F", nil]]]). | ||
|
||
.type Alias = List | ||
|
||
.decl flatten_list(l:List) | ||
.output flatten_list | ||
flatten_list(l) :- list_decl(l). | ||
flatten_list(l) :- flatten_list([_, l]). | ||
|
||
.decl alias_map(a: Alias, l:List) | ||
alias_map(l, l) :- | ||
flatten_list(l). | ||
|
||
.decl alias(a: Alias) | ||
alias(a) :- alias_map(a, _). | ||
|
||
.decl parent(a: Alias, p: Alias) | ||
.output parent | ||
parent(a, p) :- | ||
alias_map(a, [_, parent]), | ||
alias_map(p, parent). | ||
|
||
.decl has_no_parent(a: Alias) | ||
has_no_parent(a) :- | ||
alias(a), !parent(a, _). // No more error here |
Empty file.
Empty file.
7 changes: 7 additions & 0 deletions
7
tests/syntactic/equivalent_types_in_negation/flatten_list.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
nil | ||
[C, nil] | ||
[B, [C, nil]] | ||
[A, [B, [C, nil]]] | ||
[F, nil] | ||
[E, [F, nil]] | ||
[D, [E, [F, nil]]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[C, nil] nil | ||
[B, [C, nil]] [C, nil] | ||
[A, [B, [C, nil]]] [B, [C, nil]] | ||
[F, nil] nil | ||
[E, [F, nil]] [F, nil] | ||
[D, [E, [F, nil]]] [E, [F, nil]] |