mirror of
https://github.com/edwinb/Idris2-boot.git
synced 2024-09-19 20:07:20 +03:00
Tweak overloading rules
Instead of %allow_overloads, which I've never documented or explained, now we have: + if there's more than one possible name after pruning according to return type, and there is at least one name with a concrete return type, rule out the names which do not have a concrete return type. Effectively this means if there is a clash between a concrete name and a polymorphic name, we'll always take the concrete one, which is consistent with Idris 1. I still don't know if this is the right choice, but all the possibile ways of resolving ambiguity have some problems, and this is the fastest to resolve in the common case!
This commit is contained in:
parent
50441ad3df
commit
4e019d8093
@ -213,7 +213,11 @@ notOverloadable defs (concrete, fn) = notOverloadableFn (getFn fn)
|
||||
notOverloadableFn (IVar _ n)
|
||||
= do Just gdef <- lookupCtxtExact n (gamma defs)
|
||||
| Nothing => pure True
|
||||
pure (not (Overloadable `elem` flags gdef))
|
||||
pure False -- If the name exists, and doesn't have a concrete type
|
||||
-- but another possibility does, remove it from the set
|
||||
-- no matter what
|
||||
-- (TODO: Consider whether %allow_overloads should exist)
|
||||
-- (not (Overloadable `elem` flags gdef))
|
||||
notOverloadableFn _ = pure True
|
||||
|
||||
filterCore : (a -> Core Bool) -> List a -> Core (List a)
|
||||
|
Loading…
Reference in New Issue
Block a user