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

Remove eval from defcomp macro #761

Merged
merged 1 commit into from
Sep 12, 2020
Merged

Remove eval from defcomp macro #761

merged 1 commit into from
Sep 12, 2020

Conversation

lrennels
Copy link
Collaborator

@codecov
Copy link

codecov bot commented Sep 12, 2020

Codecov Report

Merging #761 into master will decrease coverage by 0.09%.
The diff coverage is 80.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #761      +/-   ##
==========================================
- Coverage   77.91%   77.82%   -0.10%     
==========================================
  Files          36       36              
  Lines        2998     2994       -4     
==========================================
- Hits         2336     2330       -6     
- Misses        662      664       +2     
Flag Coverage Δ
#unittests 77.82% <80.00%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/core/defcomp.jl 82.35% <80.00%> (-1.56%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 04a50cb...986fff1. Read the comment docs.

Copy link
Collaborator

@davidanthoff davidanthoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent!

@lrennels lrennels merged commit 51032df into master Sep 12, 2020
@lrennels lrennels deleted the eval branch September 12, 2020 22:36
@corakingdon
Copy link
Collaborator

sorry I'm late to seeing this after you merged it-- but I see that you had to change some of the tests for defaults. Did you make sure that the changed behavior makes sense? Cause it looks like you moved the code for checking the number of dimensions for a default value, and codecov says that those modified lines aren't being hit by the tests, which is supposed to be the test that you modified. does that make sense?

Comment on lines +86 to +88
if length(dimensions) != ndims(default)
error("Default value has different number of dimensions ($(ndims(dflt))) than parameter '$name' ($(length(dimensions)))")
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah actually it is just the "end" line of the if statement that codecov is complaining about. But I was surprised that the error type for that error would be UndefVarError and not still a LoadError, so I think there might be a problem here that dflt isn't defined here and that it should be default?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes, good catch! The test is now reporting a bug in the line that throws the error, i.e. in line 87 :) The test should actually test for an ErrorException, right? That is what is thrown, so any other type of error would mean something went wrong.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I was lazy when I changed that, I’ll change the error type back and correct dflt to default, I think that should solve it.

Copy link
Collaborator Author

@lrennels lrennels Sep 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, but did we conclude that it should be a LoadError or ErrorException? It's now an ErrorException (see #762 ), but even with default instead of dflt. Is there a problem here because we're calling ndims on default before it is evaluated ... or has it been evaluated at this point?

Copy link
Collaborator

@corakingdon corakingdon Sep 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think David is right, it should now be ErrorException (it was previously LoadError when it was being thrown from within eval I think)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also if you just run the part of the test file that's supposed to test this error, but run it outside of the test_throws then you can see if the error message is our constructed error message or if something else is wrong, just to be safe

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ckingdon95 smart yes I just did that and the constructed error message looks correct, so I think we can merge the PR now if someone can approve it

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.

3 participants