-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Context: show more helpful message for never called method #4805
Context: show more helpful message for never called method #4805
Conversation
Are you sure you want to mention #4185? |
sorry, it's my mistake. |
Close crystal-lang#4158 Close crystal-lang#4804 We cannot get a context from the method which is never called. But current implementation yields an error in such a case, this behavior seems wrong. This fixes it to show additional information when user tried to get a contex from never called method.
6a80e92
to
f4c3ba8
Compare
fixed. |
@@ -407,4 +407,15 @@ describe "context" do | |||
Foo.foo 100 | |||
), "self", "a" | |||
end | |||
|
|||
it "can't get a context from never called method" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"can't get context from uncalled method"
@@ -155,7 +164,11 @@ module Crystal | |||
end | |||
|
|||
if @contexts.empty? | |||
return ContextResult.new("failed", "no context information found") | |||
if @found_untyped_def | |||
return ContextResult.new("failed", "no context information found (never called method has no context anytime)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about "no context information found (methods which are never called cannot have a context)"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RX14, good but I'd slightly change the end:
s/cannot have a context/don't have a context
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
9516ad6
to
0eaa19e
Compare
ping. This seems ready to merge. |
Close #4158
Close #4804
We cannot get a context from the method which is never called. But current implementation yields an error in such a case, this behavior seems wrong.
This fixes it to show additional information when user tried to get a context from never called method.