Background
If a copy of a historical object is created, the values are automatically transferred from the original to the newly created object.
Problem
For reference values (especially ENUMS), the values are available in the revision of the original object and can therefore not be transferred directly to the copy.
Therefore, copying a historical object with non-empty reference attributes leads to the error message "Failed to set Value ... must be a current revision".
Suggested solution
If a reference is explicitly declared as "historical", the values should be transferred directly from the original to the copy.
Otherwise, the values "inCurrent()" revision would have to be set on the copy or, if a value object no longer exists, null.
The commit of the copy may still fail if a mandatory field of the copy could not be filled automatically. The caller should take care of handling this case.
Test
- test.com.top_logic.model.search.expr.TestSearchExpression.testCopy()