Skip to content

Commit

Permalink
Replace awkward code changes with steep:ignore
Browse files Browse the repository at this point in the history
Also remove RBS for currently ignored files. Will follow-up when those
check fully in later PRs.
  • Loading branch information
nixme authored and kddnewton committed Feb 24, 2024
1 parent 1252210 commit 2cae58f
Show file tree
Hide file tree
Showing 13 changed files with 10 additions and 228 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ out.svg
/sig/prism/node.rbs
/sig/prism/visitor.rbs
/sig/prism/_private/dot_visitor.rbs
/sig/prism/_private/ripper_compat.rbs
/rbi/prism.rbi

compile_commands.json
Expand Down
7 changes: 3 additions & 4 deletions Steepfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
target :lib do
signature "sig"

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

check "lib"

Expand All @@ -16,4 +14,5 @@ target :lib do
ignore "lib/prism/lex_compat.rb"
ignore "lib/prism/serialize.rb"
ignore "lib/prism/ffi.rb"
ignore "lib/prism/translation"
end
4 changes: 2 additions & 2 deletions lib/prism.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module Prism
#
# For supported options, see Prism::parse.
def self.lex_compat(source, **options)
LexCompat.new(source, **options).result #: ParseResult[Array[[[Integer, Integer], Symbol, String, untyped]]]
LexCompat.new(source, **options).result # steep:ignore
end

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

# :call-seq:
Expand Down
7 changes: 1 addition & 6 deletions lib/prism/parse_result/comments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,7 @@ def nearest_targets(node, comment)

# Attach the list of comments to their respective locations in the tree.
def attach_comments!
if ProgramNode === value
this = self #: ParseResult[ProgramNode]
Comments.new(this).attach!
else
raise
end
Comments.new(self).attach! # steep:ignore
end
end
end
6 changes: 1 addition & 5 deletions lib/prism/parse_result/newlines.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,7 @@ def visit_statements_node(node)

# Walk the tree and mark nodes that are on a new line.
def mark_newlines!
if ProgramNode === value
value.accept(Newlines.new(Array.new(1 + source.offsets.size, false)))
else
raise "ParseResult does not contain ProgramNode value"
end
value.accept(Newlines.new(Array.new(1 + source.offsets.size, false))) # steep:ignore
end
end
end
3 changes: 1 addition & 2 deletions lib/prism/pattern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,10 @@ def scan(root)
return to_enum(__method__ || raise, root) unless block_given?

@compiled ||= compile
compiled = @compiled #: Proc
queue = [root]

while (node = queue.shift)
yield node if compiled.call(node)
yield node if @compiled.call(node) # steep:ignore
queue.concat(node.compact_child_nodes)
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/prism/translation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Prism
# This module is responsible for converting the prism syntax tree into other
# syntax trees.
module Translation
module Translation # steep:ignore
autoload :Parser, "prism/translation/parser"
autoload :Ripper, "prism/translation/ripper"
autoload :RubyParser, "prism/translation/ruby_parser"
Expand Down
1 change: 0 additions & 1 deletion prism.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ Gem::Specification.new do |spec|
"sig/prism/pack.rbs",
"sig/prism/parse_result.rbs",
"sig/prism/pattern.rbs",
"sig/prism/ripper_compat.rbs",
"sig/prism/serialize.rbs",
"sig/prism/visitor.rbs",
"rbi/prism.rbi",
Expand Down
32 changes: 0 additions & 32 deletions sig/_shims/ruby_vm.rbs

This file was deleted.

28 changes: 0 additions & 28 deletions sig/prism/_private/debug.rbs

This file was deleted.

49 changes: 0 additions & 49 deletions sig/prism/_private/desugar_compiler.rbs

This file was deleted.

95 changes: 0 additions & 95 deletions sig/prism/_private/lex_compat.rbs

This file was deleted.

3 changes: 1 addition & 2 deletions templates/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -588,8 +588,7 @@ def locals
"sig/prism/mutation_compiler.rbs",
"sig/prism/node.rbs",
"sig/prism/visitor.rbs",
"sig/prism/_private/dot_visitor.rbs",
"sig/prism/_private/ripper_compat.rbs",
"sig/prism/_private/dot_visitor.rbs"
]
end

Expand Down

0 comments on commit 2cae58f

Please sign in to comment.