tor_isnt_better.nim 470 B

12345678910111213141516171819
  1. type
  2. D[T] = object
  3. E[T] = object
  4. block: # PR #22261
  5. proc d(x: D):bool= false
  6. proc d(x: int | D[SomeInteger]):bool= true
  7. doAssert d(D[5]()) == false
  8. block: # bug #8568
  9. #[
  10. Since PR #22261 and amendment has been made. Since D is a subset of D | E but
  11. not the other way around `checkGeneric` should favor proc g(a: D) instead
  12. of asserting ambiguity
  13. ]#
  14. proc g(a: D|E): string = "foo D|E"
  15. proc g(a: D): string = "foo D"
  16. doAssert g(D[int]()) == "foo D"