Skip to content

smoke-tests: showcase invalid Dart behavior for constructors#1811

Draft
pwrobeldev wants to merge 4 commits into
masterfrom
pwrobeldev/showcase-invalid-dart-behavior
Draft

smoke-tests: showcase invalid Dart behavior for constructors#1811
pwrobeldev wants to merge 4 commits into
masterfrom
pwrobeldev/showcase-invalid-dart-behavior

Conversation

@pwrobeldev

Copy link
Copy Markdown
Contributor

This draft MR will be used as test cases for the fix to show the missing requirements.

Scenario: a structure that does not define any explicit constructors and
          does not have initialized fields. It has one internal field.

Expectation: the generated all-args ctor is internal.

Actual behavior: Java/Kotlin/Swift generates correct code.
                 Dart generates invalid code -- public ctor with internal field.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
Scenario: a structure that does not define any explicit constructors and
          has a public initialized field. It has one additional internal field.

Expectation: the generated initialized-fields ctor is internal.

Actual behavior: Java/Kotlin/Swift generate correct code.
                 Dart generates invalid code -- public ctor with internal field.

Note: Dart must generate all-args-ctor (private) as well to all FFI->Dart conversion.
      That part works correctly.
Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
Scenario: a structure that does not define any constructors and
          has three public fields with default values assigned.
          The fields are of structure type and default values invoke
          overloaded field constructors.

Expectation: the generated default-values constructor properly
             initializes fields and selects constructor overloads.

Actual behavior: Java/Kotlin/Swift support overloads and properly call
                 the constructor.
                 Dart generates invalid code -- overloads are not selected.
                 The code would not compile.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
@pwrobeldev
pwrobeldev force-pushed the pwrobeldev/showcase-invalid-dart-behavior branch from 689717a to 72f031a Compare July 22, 2026 06:13
…nternal

Scenario: A structure uses `PositionalDefaults` and does not define other constructors.
          It has one public field with default value. One of fields is internal.

Expectation: Generated positional defaults constructor is not public.
             It it was public it would expose internal field.

Actual behavior: Dart/Java/Kotlin generators produce wrong code. The constructor
                 is always public.

Signed-off-by: Patryk Wrobel <183546751+pwrobeldev@users.noreply.github.com>
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.

1 participant