mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-17 13:27:30 +03:00
1.3 KiB
1.3 KiB
Resolution Errors
This transcript tests the errors printed to the user when a name cannot be resolved.
Codebase Setup
First we define differing types with the same name in different namespaces:
unique type one.AmbiguousType = one.AmbiguousType
unique type two.AmbiguousType = two.AmbiguousType
one.ambiguousTerm = "term one"
two.ambiguousTerm = "term two"
scratch/main> add
Tests
Now we introduce code which isn't sufficiently qualified. It is ambiguous which type from which namespace we mean.
We expect the output to:
- Print all ambiguous usage sites separately
- Print possible disambiguation suggestions for each unique ambiguity
-- We intentionally avoid using a constructor to ensure the constructor doesn't
-- affect type resolution.
useAmbiguousType : AmbiguousType -> ()
useAmbiguousType _ = ()
useUnknownType : UnknownType -> ()
useUnknownType _ = ()
-- Despite being a duplicate disambiguation, this should still be included in the annotations printout
separateAmbiguousTypeUsage : AmbiguousType -> ()
separateAmbiguousTypeUsage _ = ()
Currently, ambiguous terms are caught and handled by type directed name resolution, but expect it to eventually be handled by the above machinery.
useAmbiguousTerm = ambiguousTerm