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

orm,checker: variable not marked as used when inserting and storing the id #23032

Closed
Le0Developer opened this issue Dec 1, 2024 · 0 comments · Fixed by #23038
Closed

orm,checker: variable not marked as used when inserting and storing the id #23032

Le0Developer opened this issue Dec 1, 2024 · 0 comments · Fixed by #23038
Assignees
Labels
Bug This tag is applied to issues which reports bugs. ORM Bugs/feature requests, that are related to the V ORM. Status: Confirmed This bug has been confirmed to be valid by a contributor. Unit: Checker Bugs/feature requests, that are related to the type checker.

Comments

@Le0Developer
Copy link
Member

Le0Developer commented Dec 1, 2024

V doctor:

V full version: V 0.4.8 602b097.94ce64c
OS: macos, macOS, 15.1.1, 24B2091
Processor: 10 cpus, 64bit, little endian, Apple M4

getwd: /Users/leodev/p/v/fast2
vexe: /Users/leodev/p/v/v/v
vexe mtime: 2024-12-01 10:31:00

vroot: OK, value: /Users/leodev/p/v/v
VMODULES: OK, value: /Users/leodev/.vmodules
VTMP: OK, value: /tmp/v_501

Git version: git version 2.47.0
Git vroot status: weekly.2024.48-35-g94ce64c6 (1 commit(s) behind V master)
.git/config present: true

CC version: Apple clang version 16.0.0 (clang-1600.0.26.4)
emcc version: N/A
thirdparty/tcc status: thirdparty-macos-arm64 713692d4

What did you do?
./v -g -o vdbg cmd/v && ./vdbg repro.v

import db.sqlite

struct Test {
	id int @[primary; serial]
}

fn main() {
	db := sqlite.connect(':memory:')!

	x := Test{}
	x_id := sql db {
		insert x into Test
	} or {
		panic(err)
	}
	println(x_id)
}

If you don't have the x_id := part, it gets marked as used correctly.

What did you expect to see?

No warnings

What did you see instead?

repro.v:10:2: warning: unused variable: `x`
    8 |     db := sqlite.connect(':memory:')!
    9 | 
   10 |     x := Test{}
      |     ^
   11 |     x_id := sql db {
   12 |         insert x into Test

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

Huly®: V_0.6-21473

@Le0Developer Le0Developer added the Bug This tag is applied to issues which reports bugs. label Dec 1, 2024
@spytheman spytheman added Unit: Checker Bugs/feature requests, that are related to the type checker. Status: Confirmed This bug has been confirmed to be valid by a contributor. ORM Bugs/feature requests, that are related to the V ORM. labels Dec 1, 2024
@felipensp felipensp self-assigned this Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs. ORM Bugs/feature requests, that are related to the V ORM. Status: Confirmed This bug has been confirmed to be valid by a contributor. Unit: Checker Bugs/feature requests, that are related to the type checker.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants