Page MenuHomePhabricator

[YAML] Use correct source location for unknown key errors.
ClosedPublic

Authored by njames93 on Dec 10 2020, 8:21 AM.

Details

Summary

Currently unknown keys when inputting mapping traits have the location set to the Value.
Example:

YAML:1:14: error: unknown key 'UnknownKey'
{UnknownKey: SomeValue}
             ^~~~~~~~~

This is unhelpful for a user as it draws them to fix the wrong item.

Diff Detail

Event Timeline

njames93 created this revision.Dec 10 2020, 8:21 AM
njames93 requested review of this revision.Dec 10 2020, 8:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 10 2020, 8:21 AM
silvas accepted this revision.Dec 10 2020, 9:34 AM

Would be nice to find a way to test this (Maybe a FileCheck test? not sure how to set that up though; don't worry if it is too much work.)

This revision is now accepted and ready to land.Dec 10 2020, 9:34 AM

Would be nice to find a way to test this (Maybe a FileCheck test? not sure how to set that up though; don't worry if it is too much work.)

Bit of a pain to set that up explicitly. Thankfully, there are 8 test failures(per platform) introduced by this patch that demonstrate the old unexpected behaviour.
Fixing those should be semi-decent basic coverage.

njames93 updated this revision to Diff 311054.Dec 10 2020, 4:12 PM

Fix failing tests introduced with this patch.

This revision was landed with ongoing or failed builds.Dec 11 2020, 8:34 AM
This revision was automatically updated to reflect the committed changes.