Skip to content

Generate type aliases in Dart#1764

Merged
pwrobeldev merged 9 commits into
masterfrom
pwrobeldev/dart-aliases
Jun 12, 2025
Merged

Generate type aliases in Dart#1764
pwrobeldev merged 9 commits into
masterfrom
pwrobeldev/dart-aliases

Conversation

@pwrobeldev

@pwrobeldev pwrobeldev commented Jun 11, 2025

Copy link
Copy Markdown
Contributor

Added dedicated DartTypeAlias template, as type aliases (typedefs) are now
supported in Dart language (since Dart version 2.13). Updated other Dart
tempates and resolvers to treat type aliases as a normal type, instead of
skipping it through to the target type.

Added/updated related smoke and functional tests.
Unrelated smoke tests are updated in a separate commit.

Resolves: #907

This MR is a rebase of an old draft created by Daniel + new logic for
handling of typedefs declared in internal types + more tests.
Co-author: Daniel Kamkha daniel.kamkha@here.com

This change introduces generation of type aliases for
Dart. Updated other Dart templates and resolvers to
treat type aliases as a normal type, instead of
skipping it through to the target type.

This commit is just a rebase of another pull request.
Original author: Daniel Kamkha <daniel.kamkha@here.com>

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
The expected output is adjusted because now typedefs
are generated and used by their names instead resolving
full qualified names of types.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
This change introduces a new test suite for Dart.

This commit is just a rebase of another pull request.
Original author: Daniel Kamkha <daniel.kamkha@here.com>

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
This change introduces new expected output files
for Dart to showcase that global typedefs work as expected.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
@pwrobeldev

Copy link
Copy Markdown
Contributor Author

This MR is rebase of: #1163

Hsilgos
Hsilgos previously approved these changes Jun 11, 2025
When typealias is declared in an internal class or
is internal, then the generated code does not compile.

This commit showcases the bug in smoke and functional
tests. The compilation fails.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
The name of internal typealias does not need to
be prepended by underscore. We do not export
internal typealias from our library. Therefore,
it cannot be used outside.

This commit aligns the behavior with handling
of internal classes.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
The file, which contains only a global typedef does not need
to include conversion imports. They cause unused imports
warning.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
This commit shows that conversion headers are included for
typealiases usage -- in such cases conversion headers are
needed.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
@pwrobeldev
pwrobeldev merged commit 77e7da0 into master Jun 12, 2025
19 checks passed
@pwrobeldev
pwrobeldev deleted the pwrobeldev/dart-aliases branch June 12, 2025 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add full support for type aliases in Dart

2 participants