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

steep check: UnexpectedJumpValue for next x #261

Closed
palkan opened this issue Nov 19, 2020 · 1 comment · Fixed by #271
Closed

steep check: UnexpectedJumpValue for next x #261

palkan opened this issue Nov 19, 2020 · 1 comment · Fixed by #271
Labels

Comments

@palkan
Copy link

palkan commented Nov 19, 2020

Hey!

Here is an example:

# @type method foo: () -> String
def foo
  # @type block: String
  "bar".then do |str|
    next str.reverse if str == "bar"

    str
  end
end

Gives me:

$ steep check
a.rb:5:4: UnexpectedJumpValue (next str.reverse)

When annotating a block outside of a method, it works:

# @type block: String
"bar".then do |str|
  next str.reverse if str == "bar"

  str
end
$ steep check
# all goood

Debug output:

[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] def
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] block
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [synthesize:(4:3)] str
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] Factory#interface: ::String, private=false, self_type=::String
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [[X] () { (::String) -> X } -> X] [synthesize:(4:18)] procarg0
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [[X] () { (::String) -> X } -> X] [synthesize:(5:5)] begin
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [[X] () { (::String) -> X } -> X] [synthesize:(5:5)] [synthesize:(5:5)] if
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [[X] () { (::String) -> X } -> X] [synthesize:(5:5)] [synthesize:(5:5)] [synthesize:(5:25)] send
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [[X] () { (::String) -> X } -> X] [synthesize:(5:5)] [synthesize:(5:5)] [synthesize:(5:25)] [synthesize:(5:25)] lvar
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [[X] () { (::String) -> X } -> X] [synthesize:(5:5)] [synthesize:(5:5)] [synthesize:(5:25)] Factory#interface: ::String, private=false, self_type=::String
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [[X] () { (::String) -> X } -> X] [synthesize:(5:5)] [synthesize:(5:5)] [synthesize:(5:25)] [(untyped) -> bool] [synthesize:(5:32)] str
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [[X] () { (::String) -> X } -> X] [synthesize:(5:5)] [synthesize:(5:5)] [synthesize:(5:25)] [(untyped) -> bool] check_relation: self:::Object |- ::String <: untyped
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [[X] () { (::String) -> X } -> X] [synthesize:(5:5)] [synthesize:(5:5)] [synthesize:(5:25)] [(untyped) -> bool] [::String <: untyped] result=Steep::Subtyping::Result::Success
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [[X] () { (::String) -> X } -> X] [synthesize:(5:5)] [synthesize:(5:5)] [synthesize:(5:5)] next
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [[X] () { (::String) -> X } -> X] [synthesize:(5:5)] [synthesize:(5:5)] [synthesize:(5:5)] [synthesize:(5:10)] send
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [[X] () { (::String) -> X } -> X] [synthesize:(5:5)] [synthesize:(5:5)] [synthesize:(5:5)] [synthesize:(5:10)] [synthesize:(5:10)] lvar
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [[X] () { (::String) -> X } -> X] [synthesize:(5:5)] [synthesize:(5:5)] [synthesize:(5:5)] [synthesize:(5:10)] Factory#interface: ::String, private=false, self_type=::String
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [[X] () { (::String) -> X } -> X] [synthesize:(5:5)] [synthesize:(7:5)] lvar
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [[X] () { (::String) -> X } -> X] check_relation: self:::Object |- ::String <: X(1)
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [[X] () { (::String) -> X } -> X] [::String <: X(1)] result=Steep::Subtyping::Result::Success
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [[X] () { (::String) -> X } -> X] [::String <: ⟙] result=Steep::Subtyping::Result::Success
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [() -> ::Enumerator[::String, untyped]] [synthesize:(4:18)] procarg0
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [() -> ::Enumerator[::String, untyped]] [synthesize:(5:5)] begin
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [() -> ::Enumerator[::String, untyped]] [synthesize:(5:5)] [synthesize:(5:5)] if
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [() -> ::Enumerator[::String, untyped]] [synthesize:(5:5)] [synthesize:(5:5)] [synthesize:(5:25)] send
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [() -> ::Enumerator[::String, untyped]] [synthesize:(5:5)] [synthesize:(5:5)] [synthesize:(5:25)] [synthesize:(5:25)] lvar
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [() -> ::Enumerator[::String, untyped]] [synthesize:(5:5)] [synthesize:(5:5)] [synthesize:(5:25)] [synthesize:(5:32)] str
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [() -> ::Enumerator[::String, untyped]] [synthesize:(5:5)] [synthesize:(5:5)] [synthesize:(5:5)] next
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [() -> ::Enumerator[::String, untyped]] [synthesize:(5:5)] [synthesize:(5:5)] [synthesize:(5:5)] [synthesize:(5:10)] send
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [() -> ::Enumerator[::String, untyped]] [synthesize:(5:5)] [synthesize:(5:5)] [synthesize:(5:5)] [synthesize:(5:10)] [synthesize:(5:10)] lvar
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [synthesize:(4:3)] [() -> ::Enumerator[::String, untyped]] [synthesize:(5:5)] [synthesize:(7:5)] lvar
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] check_relation: self:::Object |- ::String <: ::String
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] [path=a.rb] [synthesize:(2:1)] [::String <: ::String] result=Steep::Subtyping::Result::Success
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] type checking 1 files took 0.019494 seconds
[Steep 0.36.0] [target=lib] [target#type_check(target_sources: [a.rb], validate_signatures: true)] load signature and type check took 1.813167 seconds
a.rb:5:4: UnexpectedJumpValue (next str.reverse)
@soutaro
Copy link
Owner

soutaro commented Nov 23, 2020

Good find... Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants