This seems to be an inspectcode bug, as the code is correct and compiles, but let's just work around it for now.
To avoid reverting what #6738 solved