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

Evaluate methods with short array syntax type hints correctly #8

Closed
wants to merge 13 commits into from

Conversation

jwoschitz
Copy link
Contributor

If methods had a type hint like "MyClass[]" then the expected result was an instance of "MyClass[]". Instead it should be an array of "MyClass".

This PR contains the following change:
if a type is suffixed with "[]" the type gets replaced by "array" during the parsing phase.

See tests for further details.

@rtens
Copy link
Owner

rtens commented Apr 23, 2014

I totally agree with your observation but I don't think the scenarios you added describe the behaviour very well. IMHO, if a value matches a type, the fact that the type is returned is not as important as the fact that no exception has been thrown because it contrasts with the non-matching case.

So I added these two scenarios instead, one checking that the value is correctly inferred from the hint, the other checking that the type checking works correctly.

At that point I noticed that the type checking scenarios should have their own specification and also all follow the pattern of asserting exceptions vs. non-exceptions. So I restructured them.

I hope these changes are in your favour.

@rtens rtens closed this Apr 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants