Skip to content

Conversation

bung87
Copy link
Collaborator

@bung87 bung87 commented Sep 24, 2022

fix #10833

related: #4990
#6522

uncomment typeMismatch(c.config, info, formal, arg.typ, arg) still get
t10833.nim(7, 19) Error: type mismatch: got <Foo[t10833.Bar, t10833.Baz, system.int]> but expected 'Foo[t10833.Bar, t10833.Baz, 1]'

type info loss, however I debugging in serveral steps all type check passed, in the end the int is compare in handleRange in first case f.kind == a.kind , even it loss literal info.

this may related to #20417, if merge, merge this one first.

@bung87 bung87 marked this pull request as draft September 24, 2022 23:34
@bung87
Copy link
Collaborator Author

bung87 commented Sep 25, 2022

Note here:

tests/generics/tgenerics_issues.nim fails.

@bung87
Copy link
Collaborator Author

bung87 commented Sep 26, 2022

Note the trace path here.
instantiateBody -> semProcBody -> semExpr -> semSym
->

case s.kind
  of skConst:

->

of tyStatic:
  if typ.n != nil:
    result = typ.n
    result.typ = typ.base
  else:
    result = newSymNode(s, n.info)

@bung87
Copy link
Collaborator Author

bung87 commented Sep 26, 2022

there's chance strip out static inside proc semVarOrLet

finally I use PContext determin in which context in semSym

@bung87
Copy link
Collaborator Author

bung87 commented Sep 26, 2022

TODO:
result.f = C should work, I get
Error: internal error: genLiteral(nkObjConstr)
Ideally it should work same as const d = C; result.f = d

another idea is put the const value when result default constructing, so doesn't need assign it, also assignment mismatch the semantic

@bung87 bung87 marked this pull request as ready for review September 26, 2022 12:36
@Varriount Varriount requested a review from Araq September 26, 2022 19:36
@Varriount Varriount added the Requires Araq To Merge PR should only be merged by Araq label Sep 26, 2022
@bung87 bung87 mentioned this pull request Oct 13, 2022
@bung87 bung87 marked this pull request as draft May 25, 2023 15:14
@bung87 bung87 closed this Aug 12, 2023
@bung87 bung87 deleted the fix10833 branch August 29, 2023 12:18
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
Development

Successfully merging this pull request may close these issues.

"type expected" error for proc resolution with static[int]]
2 participants