Rules DSL in 5.1 is now unloading rules if it has unreachable expressions?

As of https://community.openhab.org/t/text-rules-are-randomly-not-loaded-in-openhab-5-1/ a rule with [ lamp | in OpenHAB 5.1 sometimes fails, and sometimes not, while [GenericItem lamp| always works. In 5.0 [ lamp | always worked. My understanding is that sometimes parsing a rule produces a warning/error:

There is no context to infer the closure's argument types from. Consider typing the arguments or put the closures into a typed context.

and sometimes not. In that case it is mentioned that during boot this warning/error appears, but creating the rule after booting does not produce the warning/error.

Why does the above error/warning happen only sometimes?