Hey guys! Trying to test a new feature I've added ...
# compiler
c
Hey guys! Trying to test a new feature I've added to the compiler, which is a configuration option to enable
@JvmStatic
declarations to have the generated static method replace the companion object declaration rather than be a proxy to it, but I cannot run the tests. Every time I try to run the tests, my 32 GB of RAM is maxed out and I'm forced to hold the power button to shut down the computer so I can reboot it. I feel like this can't be an issue for most of the people working on the compiler, and also feel like I'm not meant to be running all the tests, but I don't really know that much about the tests in the compiler. Can anyone help me out?
d
It depends on what exactly you changed and how it affects regular compilation pipeline
c
I added a new cache to
JvmCachedDeclarations
to facilitate the caching of static replacement methods. I also added a new
JvmLoweredDeclarationOrigin
to distinguish the static proxy from the static rewrite. I also changed the
CompanionObjectJvmStaticTransformer
in
JvmStaticAnnotationLowering
to do the actual overwriting if the new configuration key I added is set to true.
d
In that case it's enough to run
IrBlackBoxCodegenTestGenerated
and
IrBlackBoxInlineCodegenTestGenerated
tests as sanity check You can also look at tests which lays around those two
Also note that if you change is not enabled by default, you need to write new tests which actually enable your feature
c
Okay, thanks for your help!
Hey! So I've been trying to follow your advice. I've looked at the black box tests in
testData/codegen/box
, and I don't believe how they work is suitable for what I need to test. Specifically, what I need to test is that, when my option is enabled, the output of
@JvmStatic
declarations in companion objects doesn't contain an instance method in the companion object and, if possible, that the generated static method in the base class doesn't try to delegate to one. I don't know whether I'm not seeing something or doing something wrong, or if these tests actually aren't suitable.
d
Ok, then take a look at
IrBytecodeListingTestGenerated
, which dump list of declarations from resulting bytecode
Box tests are good to check that you didn't break anything in runtime behavior of generated code
c
Yeah, okay then, thanks!