Weird behavior: I'm looking at changing `unions.py...
# development
b
Weird behavior: I'm looking at changing
unions.py
union
to just set
_is_union
to
True
instead of the weird self-reference (why is that btw?) But doing so there and in
<http://mod.rs|mod.rs>
yields errors about unions not being registered for a type that is registered šŸ˜•
āœ… 1
Copy code
pub fn is_union(py: Python, v: &PyType) -> PyResult<bool> {
  let is_union_for_attr = intern!(py, "_is_union");
  Ok(v.hasattr(is_union_for_attr)?)
}
and
Copy code
cls._is_union = True
lead to errors such as:
Copy code
Exception: Invalid Get. Because an input type for `Get(GenerateJvmLockfileFromTool, ScalafmtToolLockfileSentinel, <pants.backend.scala.lint.scalafmt.rules.ScalafmtToolLockfileSentinel object at 0x7f4a2c04ec10>)` was annotated with `@union`, the value for that type should be a member of that union. Did you intend to register a `UnionRule`? If not, you may be using the incorrect explicitly declared type.
w
Weird behavior: Iā€™m looking at changing
unions.py
union
to just set
_is_union
to
True
instead of the weird self-reference (why is that btw?)
because otherwise subclasses of the union will also be considered to be unions due to having the field
due to inheritance of the class-level attribute
b
Ah right šŸ˜•
I guess the error here is that instances of union members can't also have a union type? šŸ¤”