You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Misleading extra error message when field declaration order differs between signature & implementation #20410
typeResolvedConfig={
Config:FormatConfig
Settings:ResolvedSetting list
EditorConfigFiles:string list
Problems:EditorConfigProblem list}
Implementation
typeResolvedConfig=// FS0313: The type definitions for type 'ResolvedConfig' in the signature and implementation are not compatible because the order of the fields is different in the signature and implementation{
Config:FormatConfig
EditorConfigFiles:string list // FS0193: The module contains the field EditorConfigFiles: string list but its signature specifies Settings: ResolvedSetting list The names differ
Problems:EditorConfigProblem list
Settings:ResolvedSetting list}
Expected behavior
FS0313 should be emitted on the type. (Record field declaration order matters, since it affects the order of ctor parameters.)
Actual behavior
FS0193 is also emitted for the first out-of-order field in the implementation. There is however a field Settings: ResolvedSetting list; it's just not at the same ordinal.
The message is not strictly wrong, but it is arguably misleading. Maybe we should include wording like "the names at this position differ" or something?
Known workarounds
N/A
Related information
Current main.
I happened to notice this when testing out record type spreads in Fantomas, but the extra error message happens for explicit field declarations as well.
Activity
Fix misleading diagnostics for reordered record fields (#20559)
Fix misleading diagnostics for reordered record fields (dotnet#20559)