Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix decls of output from Prototype::Runtime #1030

Merged
merged 1 commit into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rbs/prototype/runtime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def generate_constants(mod, decls)
end

decls << AST::Declarations::Constant.new(
name: name,
name: to_type_name(name.to_s),
type: type,
location: nil,
comment: nil
Expand Down
27 changes: 27 additions & 0 deletions test/rbs/runtime_prototype_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -415,4 +415,31 @@ def m4: () -> untyped
end
end
end

module TestForEnv
# A = 1
def a
2
end
alias b a
module B
end
include B
extend B
prepend B
end

def test_decls_structure
SignatureManager.new do |manager|
manager.build do |env|
p = Runtime.new(patterns: ["RBS::RuntimePrototypeTest::TestForEnv"], env: env, merge: true)
assert_equal(p.decls.length, 1)
p.decls.each do |decl|
env << decl
end
env.resolve_type_names
assert(true) # nothing raised above
end
end
end
end