Skip to content

ast: make Scope.find methods more robust, when called on default initialised scope &Scope = unsafe { nil } fields - #20774

Merged
spytheman merged 2 commits into
vlang:masterfrom
spytheman:make_ast_Scope_methods_more_robust
Feb 10, 2024
Merged

spytheman merged 2 commits into
vlang:masterfrom
spytheman:make_ast_Scope_methods_more_robust

Conversation

@spytheman

@spytheman spytheman commented Feb 10, 2024 •

Copy link
Copy Markdown
Contributor

Fix #18324 .

…ialised `scope &Scope = unsafe { nil }` fields
Comment thread vlib/v/tests/orm_create_several_tables_test.v Outdated
@nkoehring

Copy link
Copy Markdown

One could also add a test, if all the tables are included. Not sure, if that is not already exhaustively tested, somewhere. One could otherwise add something like:

nr_tables := db.exec('select count(*) from sqlite_master')!.first()

assert nr_tables.vals.first().int() >= 2 // result is probably bigger than 2, because of auto index tables

@spytheman

Copy link
Copy Markdown
Contributor Author

This is a test for a compiler error, its purpose is not to test actual behavior of the ORM or db.sqlite. It is enough as it is.

@spytheman
spytheman merged commit 5269c02 into vlang:master Feb 10, 2024
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

Successfully merging this pull request may close these issues.

orm: segfault when having nested foreign keys

2 participants