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

Support holes as function arguments #45

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

cb372
Copy link
Owner

@cb372 cb372 commented Nov 28, 2020

Given foo.bar(123, "abc", ???), we look up the foo.bar symbol to get the types of its parameters, which gives us the type of the hole.

Note: there's a big assumption here that the number of params exactly matches the number of args, which is not true in the case of default args, varargs, etc. So this will not catch all cases, but it's a step in the right direction.

Fixes #43

Given `foo.bar(123, "abc", ???)`, we look up the `foo.bar` symbol to get
the types of its parameters, which gives us the type of the hole.

Note: there's a big assumption here that the number of params exactly
matches the number of args, which is not true in the case of default
args, varargs, etc. So this will not catch all cases, but it's a step in
the right direction.
@@ -61,11 +61,25 @@ Relevant bindings include
val hole13: (Int, String) => (String, Int) = { (a, b) => ??? }
^
src/test/resources/val-var-def-one-liners/input.scala:31:
Found hole with type: Int
Found hole with type: B
Copy link
Owner Author

Choose a reason for hiding this comment

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

I feel like if I can find the right incantation I can persuade the compiler to fill in this type param with the concrete type. More experimentation needed...

def hole15(x: String) = x.contains(???)
^
src/test/resources/val-var-def-one-liners/input.scala:35:
Found hole with type: A => Boolean
Copy link
Owner Author

Choose a reason for hiding this comment

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

Similarly here

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.

Functionality not invoked for function-typed holes
1 participant