-
Notifications
You must be signed in to change notification settings - Fork 208
Description
In our project we are using a quite unorthodox way to check whether experiments are enabled/disabled. We have a special class, let's name it ExperimentChecker, which has lots of different methods, from simple ones like isOn()/isOff() to some advanced ones.
Consider the following code:
class SomeClass(
private val expChecker: ExpChecker
) {
fun someFunc(): SomeValue {
return expChecker.check(Experiments.ExpName) {
off {
logger.log("off branch called")
SomeValue.OldValue
}
on {
logger.log("on branch called")
SomeValue.NewValue
}
}
}
}
If we try to match and remove one of the branches along with expChecker.check(Experiments.ExpName) invocation we will end up with the following code (let's remove the off branch in this example):
class SomeClass(
private val expChecker: ExpChecker
) {
fun someFunc(): SomeValue {
return logger.log("on branch")
SomeValue.NewValue
}
}
As you can see it introduces a syntax error which then crashes piranha.
I'm not sure if this is even supported by piranha. If it's not then we will have to figure it out on our own. But if it is supported then please could you point me to an example on how it should be handled? Thanks.