This PR improves the “expected type mismatch” error message by omitting the type's types when they are defeq, and putting them into separate lines when not. I found it rather tediuos to parse the error message when the expected type is long, because I had to find the `:` in the middle of a large expression somewhere. Also, when both are of sort `Prop` or `Type` it doesn't add much value to print the sort (and it’s only one hover away anyways).
33 lines
1.5 KiB
Text
33 lines
1.5 KiB
Text
struct1.lean:9:14-9:17: error: invalid resulting type, expecting 'Type _' or 'Prop'
|
|
struct1.lean:12:20-12:29: error: expected structure
|
|
|
|
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 been declared in 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 been declared in 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:5-39:9: error: omit field 'x' type to set default value
|
|
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: invalid 'private' constructor in a 'private' structure
|
|
struct1.lean:48:0-48:15: error: invalid 'protected' constructor in a 'private' structure
|
|
struct1.lean:51:0-51:19: error: invalid 'protected' field in a 'private' structure
|
|
S : Type
|
|
S.mk2 (x : Nat) : S
|