Skip to content
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

Issue 4 - Single child composable problem #7

Open
aballano opened this issue Jan 13, 2020 · 0 comments
Open

Issue 4 - Single child composable problem #7

aballano opened this issue Jan 13, 2020 · 0 comments

Comments

@aballano
Copy link
Member

Android Studio Build:

Android Studio 4.0 Canary 8
Build #AI-193.5233.102.40.6107147, built on January 2, 2020
Runtime version: 1.8.0_212-release-1586-b4-5784211 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.6
GC: ParNew, ConcurrentMarkSweep
Memory: 4012M
Cores: 12
Registry: ide.new.welcome.screen.force=true, ide.balloon.shadow.size=0
Non-Bundled Plugins: com.chrisrm.idea.MaterialThemeUI, com.squareup.sqldelight

Version of Gradle Plugin:

4.0.0-alpha08

Version of Gradle:

gradle-6.1-rc-1-all

Version of Java:

1.8

OS:

MacOs Mojave 10.14.6

Steps to Reproduce:

  • Create a simple button with more than one components inside:
  • Build the app

Expected result:

  • Any component that can only have 1 child inside should explicitly mark it this way, so adding multiple components should give a compile error

Actual result:

  • No errors, only first component is rendered.

Proposed solution:

  • The Composable annotation could contain a parameter to specify an arbitrary arity that would be enforced at compile time by the compiler plugin itself.

Sample branch:
https://github.com/arrow-kt/compose-samples/blob/gotchas/gist4/JetNews/app/src/main/java/com/example/jetnews/MainActivity.kt

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

No branches or pull requests

1 participant