Skip to content

Conversation

@cristianoc
Copy link
Collaborator

The -write flag that auto-inserted @dead annotations into source files was removed as it added significant complexity for a rarely-used feature.

Deleted

  • WriteDeadAnnotations.ml (156 lines)
  • Common.Cli.write ref
  • DceConfig.cli.write field
  • type line and type lineAnnotation in Common.ml
  • shouldWriteLineAnnotation and lineAnnotation fields in DeadWarning
  • -write CLI argument
  • ~config parameter from logAdditionalInfo (now unused)

Simplified

  • emitWarning no longer computes line annotations
  • logAdditionalInfo no longer needs config parameter
  • DeadWarning type now just has: deadWarning, path, message

Rationale

The feature:

  • Added file I/O during analysis (violated pure analysis principles)
  • Maintained global state (currentFile, currentFileLines refs)
  • Required threading lineAnnotation through warning system
  • Was rarely used (most users want to delete dead code, not annotate it)

Users who want to suppress warnings can still manually add @dead annotations.

The `-write` flag that auto-inserted `@dead` annotations into source files
was removed as it added significant complexity for a rarely-used feature.

## Deleted

- `WriteDeadAnnotations.ml` (156 lines)
- `Common.Cli.write` ref
- `DceConfig.cli.write` field
- `type line` and `type lineAnnotation` in Common.ml
- `shouldWriteLineAnnotation` and `lineAnnotation` fields in DeadWarning
- `-write` CLI argument
- `~config` parameter from `logAdditionalInfo` (now unused)

## Simplified

- `emitWarning` no longer computes line annotations
- `logAdditionalInfo` no longer needs config parameter
- DeadWarning type now just has: deadWarning, path, message

## Rationale

The feature:
- Added file I/O during analysis (violated pure analysis principles)
- Maintained global state (currentFile, currentFileLines refs)
- Required threading lineAnnotation through warning system
- Was rarely used (most users want to delete dead code, not annotate it)

Users who want to suppress warnings can still manually add `@dead` annotations.
@cristianoc cristianoc merged commit d21b1fb into reanalyze-dce-plan Dec 8, 2025
@cristianoc cristianoc deleted the dce-remove-write-annotations branch December 8, 2025 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants