federation icon indicating copy to clipboard operation
federation copied to clipboard

Remove undefined return value and add assert to type getter

Open clenfest opened this issue 4 years ago • 4 comments

All tests pass, but I need to continue to read code to make sure there isn't an existing case that could be a problem.

One definite issue is that if someone were to add a reference to type in the set parent callback, there would definitely be an assertion failure at runtime. Not sure how we feel about that.

clenfest avatar Nov 23 '21 15:11 clenfest

One definite issue is that if someone were to add a reference to type in the set parent callback, there would definitely be an assertion failure at runtime.

I'm not sure to see which callback you are referencing to/the problem involved.

pcmanus avatar Nov 24 '21 10:11 pcmanus

One definite issue is that if someone were to add a reference to type in the set parent callback, there would definitely be an assertion failure at runtime.

I'm not sure to see which callback you are referencing to/the problem involved.

No current problem, but I meant since we have the callback apparatus, if someone referenced type from there in the future, things could fail in ways that might be tough to diagnose. Nothing to do on this, but I thought I'd call it out.

clenfest avatar Nov 30 '21 04:11 clenfest

Is this ready for review? I've hold off because you mentioned still wanted to check stuffs in your first comment, but happy to have a pass if it's ready.

No current problem, but I meant since we have the callback apparatus, if someone referenced type from there in the future, things could fail in ways that might be tough to diagnose.

I'm sure I'm just being dense, but I'm still not sure to see what you are referring to. Which "callback apparatus"? Maybe a super simple example of what would fail in hard to diagnose if done would clarify it for me.

pcmanus avatar Dec 14 '21 10:12 pcmanus

Yeah, it's ready. Sorry, I was just referring to the fact that there are a lot of calls to setParent in each of the different subclasses, which in turn makes a call to onAttached. If any of the onAttached overriders were to make a reference to .type() in the future, they would get an assertion error.

clenfest avatar Dec 14 '21 20:12 clenfest