Skip to content

Commit 2cae58f

Browse files
nixmekddnewton
authored andcommitted
Replace awkward code changes with steep:ignore
Also remove RBS for currently ignored files. Will follow-up when those check fully in later PRs.
1 parent 1252210 commit 2cae58f

File tree

13 files changed

+10
-228
lines changed

13 files changed

+10
-228
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ out.svg
5858
/sig/prism/node.rbs
5959
/sig/prism/visitor.rbs
6060
/sig/prism/_private/dot_visitor.rbs
61-
/sig/prism/_private/ripper_compat.rbs
6261
/rbi/prism.rbi
6362

6463
compile_commands.json

Steepfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
target :lib do
44
signature "sig"
55

6-
# Tell Steep about stdlib require's
7-
library "ripper" # RipperCompat
8-
library "delegate" # LexCompat
9-
library "cgi" # DotVisitor
6+
# Tell Steep about any stdlib "require"s
7+
library "cgi" # in lib/prism/dot_visitor.rb (Prism::DotVisitor)
108

119
check "lib"
1210

@@ -16,4 +14,5 @@ target :lib do
1614
ignore "lib/prism/lex_compat.rb"
1715
ignore "lib/prism/serialize.rb"
1816
ignore "lib/prism/ffi.rb"
17+
ignore "lib/prism/translation"
1918
end

lib/prism.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ module Prism
4444
#
4545
# For supported options, see Prism::parse.
4646
def self.lex_compat(source, **options)
47-
LexCompat.new(source, **options).result #: ParseResult[Array[[[Integer, Integer], Symbol, String, untyped]]]
47+
LexCompat.new(source, **options).result # steep:ignore
4848
end
4949

5050
# :call-seq:
@@ -54,7 +54,7 @@ def self.lex_compat(source, **options)
5454
# returns the same tokens. Raises SyntaxError if the syntax in source is
5555
# invalid.
5656
def self.lex_ripper(source)
57-
LexRipper.new(source).result
57+
LexRipper.new(source).result # steep:ignore
5858
end
5959

6060
# :call-seq:

lib/prism/parse_result/comments.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,7 @@ def nearest_targets(node, comment)
188188

189189
# Attach the list of comments to their respective locations in the tree.
190190
def attach_comments!
191-
if ProgramNode === value
192-
this = self #: ParseResult[ProgramNode]
193-
Comments.new(this).attach!
194-
else
195-
raise
196-
end
191+
Comments.new(self).attach! # steep:ignore
197192
end
198193
end
199194
end

lib/prism/parse_result/newlines.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,7 @@ def visit_statements_node(node)
5858

5959
# Walk the tree and mark nodes that are on a new line.
6060
def mark_newlines!
61-
if ProgramNode === value
62-
value.accept(Newlines.new(Array.new(1 + source.offsets.size, false)))
63-
else
64-
raise "ParseResult does not contain ProgramNode value"
65-
end
61+
value.accept(Newlines.new(Array.new(1 + source.offsets.size, false))) # steep:ignore
6662
end
6763
end
6864
end

lib/prism/pattern.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,10 @@ def scan(root)
8787
return to_enum(__method__ || raise, root) unless block_given?
8888

8989
@compiled ||= compile
90-
compiled = @compiled #: Proc
9190
queue = [root]
9291

9392
while (node = queue.shift)
94-
yield node if compiled.call(node)
93+
yield node if @compiled.call(node) # steep:ignore
9594
queue.concat(node.compact_child_nodes)
9695
end
9796
end

lib/prism/translation.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Prism
44
# This module is responsible for converting the prism syntax tree into other
55
# syntax trees.
6-
module Translation
6+
module Translation # steep:ignore
77
autoload :Parser, "prism/translation/parser"
88
autoload :Ripper, "prism/translation/ripper"
99
autoload :RubyParser, "prism/translation/ruby_parser"

prism.gemspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ Gem::Specification.new do |spec|
133133
"sig/prism/pack.rbs",
134134
"sig/prism/parse_result.rbs",
135135
"sig/prism/pattern.rbs",
136-
"sig/prism/ripper_compat.rbs",
137136
"sig/prism/serialize.rbs",
138137
"sig/prism/visitor.rbs",
139138
"rbi/prism.rbi",

sig/_shims/ruby_vm.rbs

Lines changed: 0 additions & 32 deletions
This file was deleted.

sig/prism/_private/debug.rbs

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)