Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #6407 SomeFloat and SomeInteger types fails to differentiate in a… #20519

Closed
wants to merge 1 commit into from

Conversation

bung87
Copy link
Collaborator

@bung87 bung87 commented Oct 8, 2022

… generic call from other generic

fix #6407
fix #13549 type class

refs: #12787

refs: #10739 type Obj[A; B: not A] = object

refs: #19999 this call doesn't turn to a container of enum, so wil not compare f.base and a.base

refs: #6840 this does not seems be a issue.

refs: #4084 proc generic doesn't have constrained as return type

refs: #18314 Objects subtype generics are bound using the most broad type and not the most specific type

compiler/sigmatch.nim Outdated Show resolved Hide resolved
@Varriount Varriount added the Requires Araq To Merge PR should only be merged by Araq label Oct 9, 2022
@bung87 bung87 requested a review from Araq October 10, 2022 18:55
@bung87 bung87 marked this pull request as draft October 11, 2022 14:22
@bung87 bung87 marked this pull request as ready for review October 11, 2022 17:25
@bung87
Copy link
Collaborator Author

bung87 commented Oct 12, 2022

get better idea to reuse typeRel here. make this draft for now.

@bung87 bung87 marked this pull request as draft October 12, 2022 06:07
@bung87 bung87 closed this Oct 12, 2022
@Araq Araq reopened this Oct 13, 2022
@bung87 bung87 mentioned this pull request Oct 13, 2022
@bung87 bung87 force-pushed the fix6407_3 branch 2 times, most recently from 3e97d40 to d9eadee Compare October 15, 2022 19:35
@bung87 bung87 marked this pull request as ready for review October 15, 2022 20:11
@bung87 bung87 force-pushed the fix6407_3 branch 3 times, most recently from 85e2691 to 1add068 Compare October 15, 2022 22:40
@bung87
Copy link
Collaborator Author

bung87 commented Oct 16, 2022

Unfortunately I have to modify lib\pure\strformat.nim and tests\stdlib\tstrformat.nim to make generic constrain work. It cause by builtin formatValue generic covered all case, so I'll specific the generic constrain make it high priority, also I introduce typeClassMatches make it get higher priority than genericMatches, inside typeRel isGeneric used in many cases, even it can infered more accurate type, so I make genericMatches increment 2, higher than checkGenericConstraint.

@bung87
Copy link
Collaborator Author

bung87 commented Oct 16, 2022

have to introduce genericConstrainMatches, use genericMatches in checkGenericConstraint will make has generic constraint higher priority, it will proven fails to proc $*[T](self: Option[T]): string. which has no generic constraint but has generic instance type

@bung87
Copy link
Collaborator Author

bung87 commented Oct 30, 2022

maybe I should handle in typeRel directly, so that can reject generic match

@bung87 bung87 marked this pull request as draft April 26, 2023 03:17
@bung87 bung87 force-pushed the fix6407_3 branch 2 times, most recently from 8e28e9e to d681866 Compare April 26, 2023 03:26
…ate in a generic call from other generic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Requires Araq To Merge PR should only be merged by Araq
Projects
None yet
3 participants