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

dsl/fluent: improve Var.Type doc #81

Merged
merged 1 commit into from
Oct 1, 2020
Merged

Conversation

quasilyte
Copy link
Owner

Fixes #80

Signed-off-by: Iskander Sharipov quasilyte@gmail.com

Fixes #80

Signed-off-by: Iskander Sharipov <quasilyte@gmail.com>
@quasilyte
Copy link
Owner Author

@sebastien-rosset please take a look.

@sebastien-rosset
Copy link
Contributor

@sebastien-rosset please take a look.

Thanks! I am looking now.

// but for a function expression itself it's a *types.Signature.
//
// Suppose we have a `a.b()` expression:
// `$x()` m["x"].Type is `a.b` function type
Copy link
Contributor

@sebastien-rosset sebastien-rosset Sep 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, that's great. I'm trying to understand what the Where argument value is supposed to be in the case of a function type. Is it the output of reflect.TypeOf($x).String()? That does not seem to work.

For example:

   runtime.GC()
   fmt.Printf("Type: %v\n", reflect.TypeOf(runtime.GC)) // output is `func()`

How would we write m["x"].Type.Is(...)? If I type the rule below, the parser complains about parse type expr: can't convert func() type expression

m.Match(`$x($y)`).Where(m["x"].Type.Is("func()"))

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I remember that Is() method doesn't implement function types matching. Fixed in #82.

See tests for some examples.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ok, thank you!

@sebastien-rosset
Copy link
Contributor

LGTM

@quasilyte quasilyte merged commit 135f9b0 into master Oct 1, 2020
@quasilyte quasilyte deleted the quasilyte/doc/exprtype_doc branch October 1, 2020 00:58
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.

Improve godoc when fluent.Var.Type matches function call
2 participants