-
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(class): throw error when class is extending itself (#767)
* fix(parser): throw error when concept is extending itself in CTO Signed-off-by: Stefan Blaginov <[email protected]> Signed-off-by: Stefan Blaginov <[email protected]> * fix(parser): throw error when concept is extending itself in JSON metamodel form Signed-off-by: Stefan Blaginov <[email protected]> Signed-off-by: Stefan Blaginov <[email protected]> * fix(parser): throw error when concept is extending itself in the AST Signed-off-by: Stefan Blaginov <[email protected]> Signed-off-by: Stefan Blaginov <[email protected]> * refactor(validation): alphabetical rearrangement Signed-off-by: Stefan Blaginov <[email protected]> Signed-off-by: Stefan Blaginov <[email protected]> * test(self-extending): remove redundant tests (codepath covered in concerto-cto) Signed-off-by: Stefan Blaginov <[email protected]> Signed-off-by: Stefan Blaginov <[email protected]> * test(fix): remove unneeded import Signed-off-by: Stefan Blaginov <[email protected]> Signed-off-by: Stefan Blaginov <[email protected]> --------- Signed-off-by: Stefan Blaginov <[email protected]> Signed-off-by: Stefan Blaginov <[email protected]> Co-authored-by: Stefan Blaginov <[email protected]>
- Loading branch information
Stefan Blaginov
and
Stefan Blaginov
authored
Nov 28, 2023
1 parent
fc35a40
commit 886a91b
Showing
12 changed files
with
116 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
5 changes: 5 additions & 0 deletions
5
packages/concerto-cto/test/cto/bad/self-extending-asset.bad.cto
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,5 @@ | ||
namespace [email protected] | ||
|
||
asset Self_Extending extends Self_Extending { | ||
o String foo optional | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/concerto-cto/test/cto/bad/self-extending-concept.bad.cto
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,5 @@ | ||
namespace [email protected] | ||
|
||
concept Self_Extending extends Self_Extending { | ||
o String foo optional | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/concerto-cto/test/cto/bad/self-extending-event.bad.cto
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,5 @@ | ||
namespace [email protected] | ||
|
||
event Self_Extending extends Self_Extending { | ||
o String foo optional | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/concerto-cto/test/cto/bad/self-extending-participant.bad.cto
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,5 @@ | ||
namespace [email protected] | ||
|
||
participant Self_Extending extends Self_Extending { | ||
o String foo optional | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/concerto-cto/test/cto/bad/self-extending-transaction.bad.cto
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,5 @@ | ||
namespace [email protected] | ||
|
||
transaction Self_Extending extends Self_Extending { | ||
o String foo optional | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,4 +62,30 @@ describe('parser', () => { | |
declarations: [], | ||
})).should.throw(Error, 'Unrecognized import'); | ||
}); | ||
|
||
it('Should throw error for a self-extending declaration', () => { | ||
(() => Printer.toCTO({ | ||
'$class': '[email protected]', | ||
'namespace': '[email protected]', | ||
'declarations': [ | ||
{ | ||
'$class': '[email protected]', | ||
'name': 'Self_Extending', | ||
'isAbstract': false, | ||
'properties': [ | ||
{ | ||
'$class': '[email protected]', | ||
'name': 'foo', | ||
'isArray': false, | ||
'isOptional': true | ||
} | ||
], | ||
'superType': { | ||
'$class': '[email protected]', | ||
'name': 'Self_Extending' | ||
} | ||
} | ||
] | ||
})).should.throw(Error, 'The declaration "Self_Extending" cannot extend itself.'); | ||
}); | ||
}); |