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

@compat get for Nullable types throws a BoundsError #228

Closed
BenLauwens opened this issue Jun 18, 2016 · 3 comments
Closed

@compat get for Nullable types throws a BoundsError #228

BenLauwens opened this issue Jun 18, 2016 · 3 comments

Comments

@BenLauwens
Copy link

I am the maintainer of SimJulia and recently the @compat macro for getting a Nullable type in Julia v0.3 and Julia v0.4 throws a BoundsError.

I isolated the problem with following small example:

`using Compat

type Test
a :: Float64
end

type TestCompat
t :: @compat Nullable{Test}
function TestCompat()
tc = new()
tc.t = @compat Nullable{Test}()
return tc
end
end

tc = TestCompat()
@compat get(tc.t)`

In Julia v0.4 without the @compat macro everything works fine (a NullException is thrown) but with the macro I get the following error message:
ERROR: LoadError: BoundsError: attempt to access 2-element Array{Any,1}:
:get
:(tc.t)
at index [3]

@nalimilan
Copy link
Member

Argh, looks like the new compatibility for IOContext (#212) didn't consider the one-argument version of get.

@timholy Any ideas?

@BenLauwens Do you really need @compat for get to work on Julia 0.3? As it's a normal function, using Compat should be enough.

@BenLauwens
Copy link
Author

I removed the @compat and get works fine on Julia v0.3. The issue can be closed.
Thanks for the quick response!

Ben

@TotalVerb
Copy link
Contributor

@nalimilan: Another reason not to have one-argument get 😉.

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

No branches or pull requests

3 participants