Skip to content

Can't derive SizeOf for public inductive with private constructor #13373

@david-christiansen

Description

@david-christiansen

Prerequisites

Description

In nightlies after 2026-04-08, I get a type error in the derived SizeOf instance for an inductive type with a public and a private constructor. MWE:

module

public inductive Tag where
  | provided
  | private external

Error:

failed to generate `SizeOf` instance for `Tag`:
  type mismatch

Context

This is minimized from an example in Verso, where the private constructor is used to ensure that internal code has made a provided name unique.

Steps to Reproduce

  1. Use the latest nightly
  2. Enter the code
  3. Observe the error

Expected behavior:
No error message.

Actual behavior:

The described error:

failed to generate `SizeOf` instance for `Tag`:
  type mismatch

Versions

Lean 4.31.0-nightly-2026-04-11
Target: x86_64-unknown-linux-gnu

Additional Information

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions