Skip to content

(kernel) declaration has free variables error when extending class with typeclass parameter and extends #2611

Closed
@SabrinaJewson

Description

@SabrinaJewson

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:
    • Check that your issue is not already filed.
    • Reduce the issue to a minimal, self-contained, reproducible test case. Avoid dependencies to mathlib4 or std4.

Description

The following Lean 4 code produces an error:

class A
class B
class C [A] extends B
class D extends A, B, C
--                    ^ (kernel) declaration has free variables 'D.toC'

Context

This came about when I was defining my own classes for abstract algebra, which heavily build on other classes and use extends to minimize field repetition caused by inheritance diamonds.

Steps to Reproduce

  1. Write the code above into a Lean file
  2. Attempt to compile it

Expected behavior: No error.

Actual behavior: The type checker gives the described error.

Versions

Lean (version 4.3.0-nightly-2023-10-01, commit e6292bc, Release) on Linux 6.3.13

Impact

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P-lowWe are not planning to work on this issuebugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions