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

1.4.1 crash #65

Closed
PaulWoitaschek opened this issue Jun 13, 2022 · 2 comments · Fixed by #66
Closed

1.4.1 crash #65

PaulWoitaschek opened this issue Jun 13, 2022 · 2 comments · Fixed by #66

Comments

@PaulWoitaschek
Copy link

SwiftPoet 1.4.1 causes this crash. As the code base is very complex and I can't toString the FileSpec I can't easily share a reproducer, but from the stacktrace it's pretty clear what happens.
This worked fine in 1.4.0 and is caused by this change: 6da6707

Caused by: java.lang.IndexOutOfBoundsException: Empty list doesn't contain element at index 0.
	at kotlin.collections.EmptyList.get(Collections.kt:36)
	at kotlin.collections.EmptyList.get(Collections.kt:24)
	at io.outfoxx.swiftpoet.CodeWriter.emitTypeVariables(CodeWriter.kt:159)
	at io.outfoxx.swiftpoet.FunctionSpec.emitSignature(FunctionSpec.kt:115)
	at io.outfoxx.swiftpoet.FunctionSpec.emit$swiftpoet(FunctionSpec.kt:62)
	at io.outfoxx.swiftpoet.FunctionSpec.emit$swiftpoet$default(FunctionSpec.kt:42)
	at io.outfoxx.swiftpoet.ExtensionSpec.emit$swiftpoet(ExtensionSpec.kt:95)
	at io.outfoxx.swiftpoet.FileMemberSpec.emit$swiftpoet(FileMemberSpec.kt:41)
	at io.outfoxx.swiftpoet.FileSpec.emit(FileSpec.kt:96)
	at io.outfoxx.swiftpoet.FileSpec.writeTo(FileSpec.kt:52)
	at io.outfoxx.swiftpoet.FileSpec.writeTo(FileSpec.kt:68)
	at io.outfoxx.swiftpoet.FileSpec.writeTo(FileSpec.kt:73)
@kdubb
Copy link
Contributor

kdubb commented Jun 13, 2022

PR# #66 fixes this.

Tests for all the complex cases were present or recently added. A test for the very simplest case was missing 🤦‍♂️.

@kdubb kdubb closed this as completed in #66 Jun 13, 2022
@PaulWoitaschek
Copy link
Author

Wush that was quick. Thanks! 💨

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 a pull request may close this issue.

2 participants