diff --git a/main/pipeline/pipeline.cc b/main/pipeline/pipeline.cc index 08bff48a1..2cb13e651 100644 --- a/main/pipeline/pipeline.cc +++ b/main/pipeline/pipeline.cc @@ -57,7 +57,9 @@ class CFGCollectorAndTyper { void preTransformMethodDef(core::Context ctx, ast::ExpressionPtr &tree) { auto &m = ast::cast_tree_nonnull(tree); - if (ctx.file.data(ctx).strictLevel < core::StrictLevel::True || m.symbol.data(ctx)->flags.isOverloaded || + // With scip-ruby, we might as well try making progress with untyped code. + auto minStrictLevel = ctx.state.isSCIPRuby ? core::StrictLevel::False : core::StrictLevel::True; + if (ctx.file.data(ctx).strictLevel < minStrictLevel || m.symbol.data(ctx)->flags.isOverloaded || (m.symbol.data(ctx)->flags.isAbstract && ctx.file.data(ctx).compiledLevel != core::CompiledLevel::True)) { return; } diff --git a/test/scip/testdata/typed_false.rb b/test/scip/testdata/typed_false.rb new file mode 100644 index 000000000..6adeb1a0d --- /dev/null +++ b/test/scip/testdata/typed_false.rb @@ -0,0 +1,11 @@ +# typed: false + +class C + def f + @f = 0 + end + + def g(x) + x + @f + f + end +end diff --git a/test/scip/testdata/typed_false.snapshot.rb b/test/scip/testdata/typed_false.snapshot.rb new file mode 100644 index 000000000..b7ecb6dda --- /dev/null +++ b/test/scip/testdata/typed_false.snapshot.rb @@ -0,0 +1,20 @@ + # typed: false + + class C +# ^ definition [..] C# + def f +# ^ definition [..] C#f(). + @f = 0 +# ^^ definition [..] C#`@f`. +# ^^^^^^ reference [..] C#`@f`. + end + + def g(x) +# ^ definition [..] C#g(). +# ^ definition local 1~#3792446982 + x + @f + f +# ^ reference local 1~#3792446982 +# ^^ reference [..] C#`@f`. +# ^ reference [..] C#f(). + end + end