Skip to content

Commit 7116b41

Browse files
feat: Index # typed: false files by default (#132)
1 parent 2a7e1cf commit 7116b41

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

main/pipeline/pipeline.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ class CFGCollectorAndTyper {
5757

5858
void preTransformMethodDef(core::Context ctx, ast::ExpressionPtr &tree) {
5959
auto &m = ast::cast_tree_nonnull<ast::MethodDef>(tree);
60-
if (ctx.file.data(ctx).strictLevel < core::StrictLevel::True || m.symbol.data(ctx)->flags.isOverloaded ||
60+
// With scip-ruby, we might as well try making progress with untyped code.
61+
auto minStrictLevel = ctx.state.isSCIPRuby ? core::StrictLevel::False : core::StrictLevel::True;
62+
if (ctx.file.data(ctx).strictLevel < minStrictLevel || m.symbol.data(ctx)->flags.isOverloaded ||
6163
(m.symbol.data(ctx)->flags.isAbstract && ctx.file.data(ctx).compiledLevel != core::CompiledLevel::True)) {
6264
return;
6365
}

test/scip/testdata/typed_false.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# typed: false
2+
3+
class C
4+
def f
5+
@f = 0
6+
end
7+
8+
def g(x)
9+
x + @f + f
10+
end
11+
end
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# typed: false
2+
3+
class C
4+
# ^ definition [..] C#
5+
def f
6+
# ^ definition [..] C#f().
7+
@f = 0
8+
# ^^ definition [..] C#`@f`.
9+
# ^^^^^^ reference [..] C#`@f`.
10+
end
11+
12+
def g(x)
13+
# ^ definition [..] C#g().
14+
# ^ definition local 1~#3792446982
15+
x + @f + f
16+
# ^ reference local 1~#3792446982
17+
# ^^ reference [..] C#`@f`.
18+
# ^ reference [..] C#f().
19+
end
20+
end

0 commit comments

Comments
 (0)