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

Add a keyword name checking method to hasmethod #30712

Merged
merged 1 commit into from Jan 25, 2019

Conversation

@ararslan
Copy link
Member

commented Jan 14, 2019

With this change, hasmethod now accepts a tuple of symbols corresponding to keyword argument names to check for when finding a matching method. I came up with this implementation while experimenting with uses for FrankenTuples.

@ararslan ararslan requested a review from JeffBezanson Jan 14, 2019

@ararslan ararslan force-pushed the aa/hasmethod-kws branch 3 times, most recently from 978f3d0 to 1d2feb6 Jan 17, 2019

@ararslan

This comment has been minimized.

Copy link
Member Author

commented Jan 18, 2019

Well I've never seen this before on FreeBSD:

      From worker 2:	Assertion failed: (e && ptls->bt_size != 0), function jl_sig_throw, file /usr/home/julia/julia-fbsd-buildbot/worker/freebsdci/build/src/task.c, line 437.
      From worker 2:	
      From worker 2:	signal (6): Abort trap
      From worker 2:	in expression starting at /usr/home/julia/julia-fbsd-buildbot/worker/freebsdci/build/test/subtype.jl:1185
      From worker 2:	_thr_kill at /lib/libc.so.7 (unknown line)
      From worker 2:	__raise at /lib/libc.so.7 (unknown line)
      From worker 2:	abort at /lib/libc.so.7 (unknown line)
      From worker 2:	__assert at /lib/libc.so.7 (unknown line)
      From worker 2:	jl_sig_throw at /usr/home/julia/julia-fbsd-buildbot/worker/freebsdci/build/src/task.c:437
      From worker 2:	unknown function (ip: 0xffffffffffffffff)
      From worker 2:	Allocations: 57738554 (Pool: 57716973; Big: 21581); GC: 133

Log here: https://build.julialang.org/#/builders/68/builds/2242

Surely unrelated so I've restarted the build.

base/reflection.jl Outdated Show resolved Hide resolved
f(x::Int; y=3) = x + y
@test hasmethod(f, Tuple{Int})
@test hasmethod(f, Tuple{Int}, (:y,))
@test !hasmethod(f, Tuple{Int}, (:jeff,))

This comment has been minimized.

Copy link
@JeffBezanson

JeffBezanson Jan 18, 2019

Member

😹

base/reflection.jl Outdated Show resolved Hide resolved

@ararslan ararslan force-pushed the aa/hasmethod-kws branch from 1d2feb6 to 448b6e8 Jan 18, 2019

Add a keyword name checking method to hasmethod
With this change, `hasmethod` now accepts a tuple of symbols
corresponding to keyword argument names to check for when finding a
matching method.

@ararslan ararslan force-pushed the aa/hasmethod-kws branch from 448b6e8 to f7ece4d Jan 18, 2019

@ararslan

This comment has been minimized.

Copy link
Member Author

commented Jan 18, 2019

Looking better?

@ararslan

This comment has been minimized.

Copy link
Member Author

commented Jan 25, 2019

Bumpity bump

@StefanKarpinski

This comment has been minimized.

Copy link
Member

commented Jan 25, 2019

Jeff, if you're cool with this, just merge it.

@JeffBezanson JeffBezanson merged commit 3415875 into master Jan 25, 2019

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
julia freebsd ci Build done
Details

@JeffBezanson JeffBezanson deleted the aa/hasmethod-kws branch Jan 25, 2019

@ararslan

This comment has been minimized.

Copy link
Member Author

commented Jan 25, 2019

Thanks guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.