-
-
Notifications
You must be signed in to change notification settings - Fork 779
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
Fix exception when running ArrayPrimitive on star-projected arrays #2181
Conversation
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.
Thanks for investigating and providing a fix so quickly.
This PR looks fine. Please see my comment regarding the validity of the test snippet code.
@@ -73,6 +78,11 @@ class ArrayPrimitiveSpec : Spek({ | |||
assertThat(subject.compileAndLint(code)).isEmpty() | |||
} | |||
|
|||
it("is a star-projected array") { | |||
val code = "fun returningFunction(): Array<*> { return emptyArray() }" |
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 snippet is not a valid Kotlin code.
We have an additional CI check that verifies, whether the test code is valid.
io.gitlab.arturbosch.detekt.test.KotlinScriptException: Given Kotlin code is invalid.
Caused by: javax.script.ScriptException: Error: error: type inference failed: Not enough information to infer parameter T in inline fun <reified T> emptyArray(): Array<T>
Please specify it explicitly.
fun returningFunction(): Array<*> { return emptyArray() }
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.
That's very cool! Fixed it with emptyArray<Any>()
.
Codecov Report
@@ Coverage Diff @@
## master #2181 +/- ##
=========================================
Coverage 80.59% 80.59%
- Complexity 2028 2029 +1
=========================================
Files 338 338
Lines 5850 5850
Branches 1066 1066
=========================================
Hits 4715 4715
Misses 564 564
Partials 571 571
Continue to review full report at Codecov.
|
Closes #2176