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

cpsMagic overloading is broken on master #259

Closed
alaviss opened this issue Nov 10, 2021 · 2 comments
Closed

cpsMagic overloading is broken on master #259

alaviss opened this issue Nov 10, 2021 · 2 comments

Comments

@alaviss
Copy link
Contributor

alaviss commented Nov 10, 2021

import cps

type
  A = object

  B = object

proc wait(c: Continuation, x: A): Continuation {.cpsMagic.} = discard
proc wait(c: Continuation, x: B): Continuation {.cpsMagic.} = discard

proc foo() {.cps: Continuation.} =
  wait(B())

foo()

Got

test.nim(12, 7) Error: type mismatch: got <B>
but expected one of:
proc wait(c: Continuation; x: A): Continuation
  first type mismatch at position: 1
  required type for c: Continuation
  but expression 'B()' is of type: B
proc wait(c: Continuation; x: B): Continuation
  first type mismatch at position: 1
  required type for c: Continuation
  but expression 'B()' is of type: B
proc wait(x: A)
  first type mismatch at position: 1
  required type for x: A
  but expression 'B()' is of type: B

expression: wait(B())

Regression introduced by #258. This form of overloading is used heavily by nim-sys.

@alaviss alaviss added the bug Something isn't working label Nov 10, 2021
@disruptek
Copy link
Contributor

when compiles?

@alaviss alaviss removed the bug Something isn't working label Nov 10, 2021
@alaviss
Copy link
Contributor Author

alaviss commented Nov 10, 2021

#258 was reverted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants