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
Add test cases for constructors with SFVC
as a parameter.
#5269
base: master
Are you sure you want to change the base?
Conversation
a0626d9
to
8c2e044
Compare
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.
Duplicate test cases were removed.
...n/callBy/valueClasses/nonNullObject/defaultArguments/constructorWithInlineClassParameters.kt
Show resolved
Hide resolved
data class TestCtor1_1(val x: A = A("0")) | ||
data class TestCtor1_2(val x: A? = A("0")) |
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.
I am adding a function to verify the nullability
of a parameter.
Should I add a case where the default argument is null
?
@udalov |
...n/callBy/valueClasses/nonNullObject/defaultArguments/constructorWithInlineClassParameters.kt
Outdated
Show resolved
Hide resolved
assertEquals(TestCtor1_1(), ::TestCtor1_1.callBy(mapOf())) | ||
assertEquals(TestCtor1_2(), ::TestCtor1_2.callBy(mapOf())) | ||
assertEquals(TestCtor32_1(), ::TestCtor32_1.callBy(mapOf())) | ||
assertEquals(TestCtor32_2(), ::TestCtor32_2.callBy(mapOf())) | ||
assertEquals(TestCtor33_1(), ::TestCtor33_1.callBy(mapOf())) | ||
assertEquals(TestCtor33_2(), ::TestCtor33_2.callBy(mapOf())) | ||
assertEquals(TestCtor64_1(), ::TestCtor64_1.callBy(mapOf())) | ||
assertEquals(TestCtor64_2(), ::TestCtor64_2.callBy(mapOf())) | ||
assertEquals(TestCtor65_1(), ::TestCtor65_1.callBy(mapOf())) | ||
assertEquals(TestCtor65_2(), ::TestCtor65_2.callBy(mapOf())) |
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.
First, I apologize for not confirming the success of the test due to a misunderstanding.
I discovered that bytecode compatibility had been broken.
This test is not inherently successful due to KT-57357.
In fact, FireLightTreeBlackBoxCodegenTestGenerated
, FirePsiBlackBoxCodegenTestGenerated
and IrBlackBoxCodegenTestGenerated
fail.
So I attempted to change the test as follows to make it a failing test (I am referring to this)
assertFailsWith<Error>("Remove assertFailsWith and try again, as KT-57357 may have been fixed.") {
assertEquals(TestCtor1_1(), ::TestCtor1_1.callBy(mapOf()))
assertEquals(TestCtor1_2(), ::TestCtor1_2.callBy(mapOf()))
assertEquals(TestCtor32_1(), ::TestCtor32_1.callBy(mapOf()))
assertEquals(TestCtor32_2(), ::TestCtor32_2.callBy(mapOf()))
assertEquals(TestCtor33_1(), ::TestCtor33_1.callBy(mapOf()))
assertEquals(TestCtor33_2(), ::TestCtor33_2.callBy(mapOf()))
assertEquals(TestCtor64_1(), ::TestCtor64_1.callBy(mapOf()))
assertEquals(TestCtor64_2(), ::TestCtor64_2.callBy(mapOf()))
assertEquals(TestCtor65_1(), ::TestCtor65_1.callBy(mapOf()))
assertEquals(TestCtor65_2(), ::TestCtor65_2.callBy(mapOf()))
}
However, after making this change, BlackBoxCodegenTestGenerated
now fails.
This indicates that the bytecode has been destructively modified.
What should I do in such a case?
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.
Ticket submitted.
https://youtrack.jetbrains.com/issue/KT-67209
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.
Please add // IGNORE_BACKEND: JVM
directive to this test, it will make the test pass only for the combination of K1 + old JVM backend.
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.
I did this and several other errors occurred. 8880205
I am sorry, but could you please confirm this?
BlackBoxCodegenTestGenerated
Looks like this test can be unmuted. Remove JVM from the IGNORE_BACKEND directive for ClassicFrontend for JVM
java.lang.AssertionError: Looks like this test can be unmuted. Remove JVM from the IGNORE_BACKEND directive for ClassicFrontend for JVM
IrBlackBoxCodegenTestGenerated/FirPsiBlackBoxCodegenTestGenerated/FirLightTreeBlackBoxCodegenTestGenerated(Only the hash values after @
were different)
This callable does not support a default call: public constructor TestCtor1_1(x: A = ...) defined in TestCtor1_1[DeserializedClassConstructorDescriptor@2e04b974]
kotlin.reflect.jvm.internal.KotlinReflectionInternalError: This callable does not support a default call: public constructor TestCtor1_1(x: A = ...) defined in TestCtor1_1[DeserializedClassConstructorDescriptor@2e04b974]
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.
Sorry, I was wrong, instead of // IGNORE_BACKEND: JVM
use // IGNORE_BACKEND: JVM_IR
and regenerate tests one more time.
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.
Thank you, the test is now successful!
I have pushed the fix.
ced6ebc
ba8ba1d
to
8880205
Compare
Too much time had passed, so I |
Completed missing test cases regarding the type that
value class
wraps and nullability as a parameter.For
SFCV
, these test cases are largely missing.I would like to continue to contribute to the completion of such test cases.
By the way, are there any rules on how to write commit messages?
Also, are there any recommended per-commit guidelines?
I have had these corrected several times and I apologize for that.