-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
propagate method metadata to keyword sorter methods #45041
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -562,6 +562,9 @@ | |||
,(if (any kwarg? pargl) (gensy) UNUSED) | ||||
(call (core kwftype) ,ftype)) ,kw ,@pargl ,@vararg) | ||||
`(block | ||||
;; propagate method metadata to keyword sorter | ||||
,@(map propagate-method-meta (filter meta? prologue)) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should filter out expressions that end up empty, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Line 527 in a4e275b
|
||||
,@(filter argwide-nospecialize-meta? prologue) | ||||
,@(let ((lnns (filter linenum? prologue))) | ||||
(if (pair? lnns) | ||||
(list (car lnns)) | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For purity we can only keep the ones that are true of keyword sorters. Safer not to propagate them at all. But I think the following apply to keyword sorters:
But please check me on that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think keyword sorters are usually:
:consistent
:effect_free
:terminates_locally
(:terminates_globally
requires that of the body function itself):notaskstate
but they are not
:nothrow
(since they can throw any ofTypeError
/UndefKeywordError
/MethodError
).Well, I'd argue it is okay to propagate the effects assumed by
Base.@assume_effects
to keyword sorters, since the point of using the macro to override the conclusion that is otherwise derived by the effect analysis.If we write
then IMO we'd like to assume both
specific(Int, Integer)
andspecific(Int, Integer; v=42)
are:total
(and therefore:nothrow
also)?