Skip to content

Remove dead code: immutable_or_opaque() and cap_immutable_or_opaque() #4950

@SeanTAllen

Description

@SeanTAllen

Summary

immutable_or_opaque() in alias.c and cap_immutable_or_opaque() in cap.c are dead code that should be removed.

Details

immutable_or_opaque() was introduced in PR #1124 ("Restrict mutable tuple recovery", 2016) and was called from recover_type() in alias.c. Its sole non-recursive caller was removed in PR #2585 ("Relax the rules for tuple recovery", 2018). Since then, the function is only called recursively by itself — it has no entry point and is unreachable.

cap_immutable_or_opaque() in cap.c is only called from within immutable_or_opaque(), making it transitively dead as well.

Both functions are declared in their respective headers (alias.h line 21, cap.h line 97) but have zero live callers anywhere in the codebase.

Additional note

As noted in the viewpoint_lower investigation, immutable_or_opaque() uses viewpoint_lower for arrow types (line 699 of alias.c), which is the pre-#4458 approach. This would be an analogous issue to the one fixed in #4458 if the code were live, but since it's dead, the fix is simply removal.

Scope

Remove the following:

  • immutable_or_opaque() definition in alias.c (lines 675–730)
  • immutable_or_opaque() declaration in alias.h (line 21)
  • cap_immutable_or_opaque() definition in cap.c
  • cap_immutable_or_opaque() declaration in cap.h (line 97)

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions