-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Better positions for infix operations #1941
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
Conversation
This has two advantages: - We can distinguish BackquotedIdent from Ident, allowing the user to use a defined "type `&`", see testcase. - We get better positions for the operators. This is useful in IDEs, for example to get the type at point.
Preserving the position of infix operators is useful for IDEs' type-at-point. We also preserve the position of the untyped lhs of right-associative operators, this is useful both for IDEs and for error messages, before: 4 |val x: List[Int] = "foo" :: List(1) | ^ | found: String($1$) | required: Int | After: scala> val x: List[Int] = "foo" :: List(1) -- [E007] Type Mismatch Error: <console> --------------------------------------- 4 |val x: List[Int] = "foo" :: List(1) | ^^^^^ | found: String($1$) | required: Int | Note: It would be even nicer if we displayed "String" instead of "String($1$)" since $1$ is synthetic, this commit does not address this.
70388bc
to
b0576e9
Compare
@felixmulder Can we get rid of validate-main? It's marked pending on all new PRs so they don't get green checkmarks |
I agree, new bot tomorrow :)
…On Sun, Feb 5, 2017, 18:36 Guillaume Martres ***@***.***> wrote:
@felixmulder <https://github.com/felixmulder> Can we get rid of
validate-main? It's marked pending on all new PRs so they don't get green
checkmarks
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1941 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABdYwWPjXrlyeVDaELaifuoZHAACoNBrks5rZgiPgaJpZM4L3fES>
.
|
I wonder whether this is not a partial solution. What do we do about definition sites, e.g.
I am asking to better evaluate whether we should fix this in the trees (which might become costly in terms of resources), or whether we should fix this by reading the source and correcting for occurrences of "`" there. |
This PR does several things so I'm not sure what you're pointing to with your example, could you be more specific? |
I mean, replace |
OK, I see. Using |
@smarter Yes, the explanations make sense. LGTM |
Review by @odersky