Make typeRel behave to spec (#22261)

The goal of this PR is to make `typeRel` accurate to it's definition for
generics:
```
# 3) When used with two type classes, it will check whether the types
# matching the first type class (aOrig) are a strict subset of the types matching
# the other (f). This allows us to compare the signatures of generic procs in
# order to give preferrence to the most specific one:
```

I don't want this PR to break any code, and I want to preserve all of
Nims current behaviors. I think that making this more accurate will help
serve as ground work for the future. It may not be possible to not break
anything but this is my attempt.

So that it is understood, this code was part of another PR (#22143) but
that problem statement only needed this change by extension. It's more
organized to split two problems into two PRs and this issue, being
non-breaking, should be a more immediate improvement.

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
This commit is contained in:
Ryan McConnell
2023-09-30 04:34:14 +00:00
committed by GitHub
parent 7146307823
commit b2ca6bedae
4 changed files with 78 additions and 29 deletions

View File

@@ -1,5 +1,7 @@
import std/[times, strformat]
import std/assertions
doAssert fmt"{getTime()}" == $getTime()
doAssert fmt"{now()}" == $now()
let aTime = getTime()
doAssert fmt"{aTime}" == $aTime
let aNow = now()
doAssert fmt"{aNow}" == $aNow