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

cross-module sink analysis broken #24764

Open
arnetheduck opened this issue Mar 10, 2025 · 2 comments
Open

cross-module sink analysis broken #24764

arnetheduck opened this issue Mar 10, 2025 · 2 comments

Comments

@arnetheduck
Copy link
Contributor

Nim Version

2.0, recent devel

Description

2.0, devel

a.nim:

type QObject* {.inheritable.} = object
proc `=destroy`(self: var QObject) = discard
proc `=sink`(dest: var QObject, source: QObject) = discard
proc `=copy`(dest: var QObject, source: QObject) {.error.}

b.nim:

import a

type QWidget* = object of QObject
proc `=copy`(dest: var QWidget, source: QWidget) {.error.}
proc `=sink`(dest: var QWidget, source: QWidget) =
  `=sink`(QObject(dest), QObject(source))

proc show(v: QWidget) = discard

proc main() =
  let btn = QWidget()

  let tmp = proc() =
    btn.show()

  btn.show()

main()

Current Output

/testit.nim(6, 34) Error: '=dup' is not available for type <QWidget>, which is inferred from unavailable '=copy'; requires a copy because it's not the last read of 'source'; try to make source a 'sink' parameter; routine: =sink

Expected Output


Known Workarounds

No response

Additional Information

No response

@arnetheduck
Copy link
Contributor Author

this, of course, is an attempt to work around #24762

@arnetheduck
Copy link
Contributor Author

switching to include a makes the example work 🤕

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

1 participant