-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add two new semantic checks for dtors (#187)
- Loading branch information
1 parent
0bdeade
commit 5331d41
Showing
8 changed files
with
49 additions
and
0 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
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
1 change: 1 addition & 0 deletions
1
test/test-files/analyzer/methods/error-destructor-is-function/exception.out
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 @@ | ||
Semantic error in ./test-files/analyzer/methods/error-destructor-is-function/source.spice:5:1: Destructor must be a procedure: Destructors are not allowed to be of type function |
13 changes: 13 additions & 0 deletions
13
test/test-files/analyzer/methods/error-destructor-is-function/source.spice
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,13 @@ | ||
type TestStruct struct { | ||
bool test | ||
} | ||
|
||
f<bool> TestStruct.dtor() { | ||
printf("Dtor called"); | ||
return false; | ||
} | ||
|
||
f<int> main() { | ||
TestStruct t = TestStruct(); | ||
printf("Test: %d\n", 0o0000777); | ||
} |
1 change: 1 addition & 0 deletions
1
test/test-files/analyzer/methods/error-destructor-with-args/exception.out
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 @@ | ||
Semantic error in ./test-files/analyzer/methods/error-destructor-with-args/source.spice:5:1: Destructors must not have parameters: It is not allowed to specify parameters for destructors |
12 changes: 12 additions & 0 deletions
12
test/test-files/analyzer/methods/error-destructor-with-args/source.spice
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,12 @@ | ||
type TestStruct struct { | ||
bool test | ||
} | ||
|
||
p TestStruct.dtor(int test) { | ||
printf("Dtor called"); | ||
} | ||
|
||
f<int> main() { | ||
TestStruct t = TestStruct(); | ||
printf("Test: %d\n", 0o0000777); | ||
} |