lean4-htt/tests/elab_fail/struct1.lean.out.expected
Kyle Miller 27b583d304
feat: mutually dependent structure default values, and avoiding self-dependence (#12841)
This PR changes the elaboration of the `structure`/`class` commands so
that default values have later fields in context as well. This allows
field defaults to depend on fields that come both before and after them.
While this was already the case for inherited fields to some degree, it
now applies uniformly to all fields. Additionally, when elaborating the
default value for a field, all fields that depend on it are cleared from
the context to avoid situations where the default value depends on
itself.

This addresses an issue reported by Aaron Liu [on
Zulip](https://leanprover.zulipchat.com/#narrow/channel/270676-lean4/topic/default.20structure.20values.20can.20depend.20on.20themselves/near/578014370).
2026-03-09 04:15:06 +00:00

43 lines
1.8 KiB
Text

struct1.lean:9:14-9:17: error: Invalid resulting type: Expected a sort
Hint: Examples of valid sorts include `Type _`, `Sort _`, and `Prop`
struct1.lean:12:20-12:29: error: expected structure
Hint: This error is possibly due to a change in the `structure` syntax. Now the syntax is `structure S : Type extends P` rather than `structure S extends P : Type`.
The purpose of the change is to accommodate `structure S extends toP : P` syntax for naming parent projections.
struct1.lean:15:28-15:33: warning: Field `x` from `B` has already been declared
struct1.lean:16:1-16:2: error: Field `x` has already been declared in a parent structure
struct1.lean:17:30-17:35: warning: Duplicate parent structure `A`; skipping
struct1.lean:19:27-19:33: error: Field type mismatch: Field `x` from parent `B` has type
Bool
but is expected to have type
Nat
struct1.lean:30:1-30:2: error: Field `x` has already been declared
struct1.lean:33:1-33:2: error: Field `x` has already been declared in a parent structure
struct1.lean:36:6-36:10: error: Type mismatch
true
has type
Bool
but is expected to have type
Nat
struct1.lean:39:1-39:2: error: Type mismatch
true
has type
Bool
but is expected to have type
Nat
struct1.lean:42:12-42:16: error: Type mismatch
true
has type
Bool
but is expected to have type
Nat
struct1.lean:45:0-45:13: error: Constructor cannot be marked `private` because it is already in a `private` structure
Hint: Remove `private` modifier from constructor
p̵r̵i̵v̵a̵t̵e̵ ̵mk ::
struct1.lean:48:0-48:15: error: Constructor cannot be `protected` because this structure is `private`
struct1.lean:51:0-51:19: error: Field cannot be marked `protected` because this structure is `private`
Spriv : Type
struct1.lean:57:7-57:12: error(lean.unknownIdentifier): Unknown constant `S.mk2`