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 compilation issue under OTP 19 #138

Merged
merged 1 commit into from
Jun 24, 2016
Merged

Fix compilation issue under OTP 19 #138

merged 1 commit into from
Jun 24, 2016

Conversation

paulcsmith
Copy link
Contributor

There is an issue with ExMachina when used with OTP 19

== Compilation error on file test/support/test_factory.ex ==
** (ArgumentError) argument error
    (stdlib) erl_anno.erl:318: :erl_anno.set(:file, 'nofile', -1)
    (stdlib) erl_parse.yrl:1516: anonymous fn/3 in :erl_parse.map_anno/2
    (stdlib) erl_parse.yrl:1631: :erl_parse.modify_anno1/3
    (stdlib) erl_parse.yrl:1517: :erl_parse.map_anno/2
    (stdlib) erl_lint.erl:703: :erl_lint."-set_file/2-lc$^0/1-0-"/2
    (stdlib) erl_lint.erl:448: :erl_lint.exprs_opt/3
    (stdlib) erl_eval.erl:173: :erl_eval.check_command/

By removing the lineL -1 the issue goes away. There is also no warning
when doing this so it can be safely removed.

@jsteiner
Copy link
Contributor

LGTM!

There is an issue with ExMachina when used with OTP 19

```
== Compilation error on file test/support/test_factory.ex ==
** (ArgumentError) argument error
    (stdlib) erl_anno.erl:318: :erl_anno.set(:file, 'nofile', -1)
    (stdlib) erl_parse.yrl:1516: anonymous fn/3 in :erl_parse.map_anno/2
    (stdlib) erl_parse.yrl:1631: :erl_parse.modify_anno1/3
    (stdlib) erl_parse.yrl:1517: :erl_parse.map_anno/2
    (stdlib) erl_lint.erl:703: :erl_lint."-set_file/2-lc$^0/1-0-"/2
    (stdlib) erl_lint.erl:448: :erl_lint.exprs_opt/3
    (stdlib) erl_eval.erl:173: :erl_eval.check_command/
```

By removing the `line: -1` the issue goes away. There is also no warning
when doing this so it can be safely removed.
@nathany
Copy link

nathany commented Jun 24, 2016

Thanks.

We are using line -1 because we don't want warnings coming from

save_record/1 when someone defines there own save_record/1 function.

I'm just curious what the difference in behaviour will be now (I don't quite understand this aspect of Elixir/Erlang).

Also note:
elixir-lang/elixir#4617 (comment)

@paulcsmith
Copy link
Contributor Author

@nathany It appears there is no difference in behavior now because we no longer define factories with factory instead it's factory_#{name_of_factory}. Also because save_record is now deprecated and we are using ExMachina.Strategy. So now it's just there as a catch all for those upgrading from old versions that may be calling factory(:foo). So once they upgrade to the new factory definition syntax they shouldn't see any warnings. If people do see warnings from this then an issue should be opened, but I don't think they will.

Great question though!

@nathany
Copy link

nathany commented Jun 24, 2016

Thanks @paulcsmith. Any plans to backport this fix to 0.6.x? (otherwise I may fork it and do that)

Or is master close to a point where 1.0.0-beta.1 could be uploaded to hex as a pre-release?

@paulcsmith
Copy link
Contributor Author

I probably won’t back port it since OTP 19 is super new and 1.0 is about to be released to hex :D #139 #139

On Jun 24, 2016, at 2:07 PM, Nathan Youngman [email protected] wrote:

Thanks @paulcsmith https://github.com/paulcsmith. Any plans to backport this fix to 0.6.x? (otherwise I may fork it and do that)

Or is master close to a point where 1.0.0-beta.1 could be uploaded to hex as a pre-release?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub #138 (comment), or mute the thread https://github.com/notifications/unsubscribe/AABXeslg2fx-4t77F8Qw-tthUUjpEzGeks5qPBz7gaJpZM4I99bQ.

merqlove pushed a commit to cnsa/ex_machina that referenced this pull request Jul 16, 2016
There is an issue with ExMachina when used with OTP 19

```
== Compilation error on file test/support/test_factory.ex ==
** (ArgumentError) argument error
    (stdlib) erl_anno.erl:318: :erl_anno.set(:file, 'nofile', -1)
    (stdlib) erl_parse.yrl:1516: anonymous fn/3 in :erl_parse.map_anno/2
    (stdlib) erl_parse.yrl:1631: :erl_parse.modify_anno1/3
    (stdlib) erl_parse.yrl:1517: :erl_parse.map_anno/2
    (stdlib) erl_lint.erl:703: :erl_lint."-set_file/2-lc$^0/1-0-"/2
    (stdlib) erl_lint.erl:448: :erl_lint.exprs_opt/3
    (stdlib) erl_eval.erl:173: :erl_eval.check_command/
```

By removing the `line: -1` the issue goes away. There is also no warning
when doing this so it can be safely removed.
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