diff --git a/scip_indexer/SCIPIndexer.cc b/scip_indexer/SCIPIndexer.cc index e6da384bf3..b2c7ab2d8e 100644 --- a/scip_indexer/SCIPIndexer.cc +++ b/scip_indexer/SCIPIndexer.cc @@ -107,8 +107,12 @@ static bool isTemporary(const core::GlobalState &gs, const core::LocalVariable & if (var.isSyntheticTemporary(gs)) { return true; } - return var._name == Names::finalReturn() || var._name == Names::blockPreCallTemp() || - var._name == Names::blockTemp() || var._name == Names::blockPassTemp() || var._name == Names::forTemp(); + auto n = var._name; + return n == Names::blockPreCallTemp() || n == Names::blockTemp() || n == Names::blockPassTemp() || + n == Names::forTemp() || n == Names::blkArg() || n == Names::blockCall() || + // Insert checks because sometimes temporaries are initialized with a 0 unique value. 😬 + n == Names::finalReturn() || n == NameRef::noName() || n == Names::blockCall() || n == Names::selfLocal() || + n == Names::unconditional(); } struct LocalOccurrence { diff --git a/test/scip/scip_test.bzl b/test/scip/scip_test.bzl index 08867adfc9..bf0ca87743 100644 --- a/test/scip/scip_test.bzl +++ b/test/scip/scip_test.bzl @@ -47,7 +47,7 @@ def scip_test(path): data = data, size = "small", ) - update_test_name = "update_".format(test_name) + update_test_name = "update_{}".format(test_name) native.sh_test( name = update_test_name, srcs = ["scip_test_runner.sh"], diff --git a/test/scip/testdata/for.rb b/test/scip/testdata/for.rb new file mode 100644 index 0000000000..a9054043c0 --- /dev/null +++ b/test/scip/testdata/for.rb @@ -0,0 +1,12 @@ +# typed: true + +def for_loop() + y = 0 + for x in [1, 2, 3] + y += x + for x in [3, 4, 5] + y += x + end + end + y +end diff --git a/test/scip/testdata/for.snapshot.rb b/test/scip/testdata/for.snapshot.rb new file mode 100644 index 0000000000..76bfc889d6 --- /dev/null +++ b/test/scip/testdata/for.snapshot.rb @@ -0,0 +1,25 @@ + # typed: true + + def for_loop() +#^^^^^^^^^^^^^^ definition scip-ruby gem TODO TODO for_loop(). +#^^^^^^^^^^^ definition scip-ruby gem TODO TODO (). + y = 0 +# ^ definition local 1~#1120785331 + for x in [1, 2, 3] +# ^ definition local 2~#1120785331 + y += x +# ^ reference local 1~#1120785331 +# ^ reference (write) local 1~#1120785331 +# ^ reference local 2~#1120785331 + for x in [3, 4, 5] +# ^ definition local 3~#1120785331 + y += x +# ^ reference local 1~#1120785331 +# ^ reference (write) local 1~#1120785331 +# ^^^^^^ reference local 1~#1120785331 +# ^ reference local 3~#1120785331 + end + end + y +# ^ reference local 1~#1120785331 + end