-
Notifications
You must be signed in to change notification settings - Fork 455
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 function$
entirely.
#7208
Conversation
cc48899
to
c250201
Compare
@@ -1195,7 +1195,9 @@ | |||
addValueReference OptArg.res:1:4 --> OptArg.res:1:29 | |||
addValueReference OptArg.res:3:4 --> OptArg.res:3:17 | |||
addValueReference OptArg.res:3:4 --> OptArg.res:3:27 | |||
DeadOptionalArgs.addReferences foo called with optional argNames:x argNamesMaybe: OptArg.res:5:7 |
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.
Need to look into these changes: the loc of parameters has changed.
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.
These changes appear to be correct.
@@ -9,11 +9,12 @@ ContextPath Value[someFunc] | |||
Path someFunc | |||
argAtCursor: unlabelled<0> | |||
extracted params: | |||
[int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] | |||
[( |
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.
Need to look into these changes: the loc of parameters has changed.
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.
Given this function type:
type t = ( x: int
^ ^
f t
The parser updates the location of the top-level node to start at location f
.
So in the case of function$< Tarrow>
the top-level node starts at f
and the Tarrow
node starts at t
.
Now that Tarrow
is the top-level node, it starts at f
.
Neither is optimal, perhaps at some point one could consider a better representation of function types, where the locations of the overall type, and individual labels is straightforward. (Labels themselves are a little funny with optional parameters).
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.
CC @zth
c250201
to
c2f8cca
Compare
49acad1
to
674c4bf
Compare
674c4bf
to
b71324f
Compare
@@ -132,7 +132,7 @@ type t = @attr (foo, @attr2 ~f: bar, @attr3 ~f: baz) => unit | |||
type t = @attr (string => @attr (int => unit)) | |||
type t = @attr (string, int) => @attr (int, float) => unit | |||
type t = @attr (int => @attr (int, float) => @attr (unit => unit => unit)) | |||
type t = @attr (@attr2 ~f: int, @attr3 ~g: float) => unit | |||
type t = (@attr @attr2 ~f: int, @attr3 ~g: float) => unit |
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.
This change doesn't look correct?
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.
There's a single node.
No way to distinguish inside and outside the parens.
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 thought @attr
was on the whole function and @attr2
was on the first arg.
So what exactly are @attr
and @attr2
on now?
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.
Later on, a good representation should probably take a list of params, each one with its own locations and attributes.
Then the single function node could have its own location and attributes.
We're bound to having to convert back and forth with the original parse tree for ast compatibility, so either one would have to preserve all information,or at least all the info required for the later phases of the compiler (other than pretty printing).
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 thought
@attr
was on the whole function and@attr2
was on the first arg.So what exactly are
@attr
and@attr2
on now?
The only attributes are at the level of ast nodes.
The type (a, b) => c is just a pretty printed form for 2 ast nodes. (The outer one has the arity info).
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.
So (a,b) => c is really a =2=> (b => c)
Attributes are on the arrow nodes so the there's no distinction between an attribute on a, and on the whole type: it's the same node, the outer one.
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.
Cleaning up these things is exactly what we need custom asts for.
This aspect can be cleaned up in a further refinement.
Tested against a real world project without any issues! |
No description provided.