-
-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(aliasing): tests import aliasing #977
chore(aliasing): tests import aliasing #977
Conversation
Signed-off-by: sanketshevkar <[email protected]>
Signed-off-by: sanketshevkar <[email protected]>
Signed-off-by: sanketshevkar <[email protected]>
Signed-off-by: sanketshevkar <[email protected]>
Signed-off-by: sanketshevkar <[email protected]>
Signed-off-by: sanketshevkar <[email protected]>
Signed-off-by: sanketshevkar <[email protected]>
Signed-off-by: sanketshevkar <[email protected]>
Signed-off-by: sanketshevkar <[email protected]>
Signed-off-by: sanketshevkar <[email protected]>
I thought we could extend scalar types bu other scalar types, but that's not the case. I wanted to import alias an scalar type. Declare a new scalar type and extend it with the one which was imported. |
@@ -33,9 +33,9 @@ function copyFiles(files, destDir) { | |||
} | |||
|
|||
const lcovs = glob.sync(globPattern).map((dir) => { | |||
const packageName = dir.split('/').pop(); | |||
const packageName = dir.split(path.sep).join('/').split('/').pop(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
} | ||
], | ||
"location": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you remove the locations from the ast please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is doing a doing a check on the parsed cto model with the ast.
|
||
it('should be able get validate a decorator whose argument is an imported type which is aliased', () => { | ||
const classDeclaration = resolvedModelManager.getType('[email protected]'); | ||
const decorator = classDeclaration.getDecorators()[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also check the decorator for the whole model?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes works!
Added a new test to validate that.
Signed-off-by: sanketshevkar <[email protected]>
@test(Kid) | ||
namespace [email protected] | ||
|
||
import [email protected].{MyString as Str,Child as Kid} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it's jet lag, but I find these examples hard to parse. Let's give the identifiers more descriptive names to make the tests easier to understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
Signed-off-by: sanketshevkar <[email protected]>
Closes #972
Changes
Added to new optionalresolvedName property to TypeIdenifier. This is to preserve the aliased name property which will have the local name for the aliased type. resolvedName will contain the origonal type name. It will get added only for the declrations ot types that "imported and aliased".
With the current implementation the value of the name property is different for a normal ast (local name) vs a resolved ast (original type name). This can be very confusing.
The above changes have been released in
[email protected]
.This PR mostly focuses on adding the unit tests to concerto apis to reinforce the import aliasing feature.
Tests for the following have been added specifically targeting import aliasing:
Author Checklist
--signoff
option of git commit.main
fromfork:branchname