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

fix: correct highlight interpolation in explain message #14802

Merged
merged 1 commit into from
Mar 29, 2022

Conversation

ckipp01
Copy link
Member

@ckipp01 ckipp01 commented Mar 29, 2022

Currently the output of explain when you are missing a return type in
an abstract declaration looks like this:

scala> trait Foo:
     |   def foo
-- [E019] Syntax Error: --------------------------------------------------------
2 |  def foo
  |         ^
  |         Missing return type
  |-----------------------------------------------------------------------------
  | Explanation (enabled by `-explain`)
  |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  | An abstract declaration must have a return type. For example:
  |
  | trait Shape {hl(
  |   def area: Double // abstract declaration returning a Double
  | )}
   -----------------------------------------------------------------------------

This fixes the interpolation issue so the return correctly shows:

scala> trait Foo:
     |   def foo
-- [E019] Syntax Error: --------------------------------------------------------
2 |  def foo
  |         ^
  |         Missing return type
  |-----------------------------------------------------------------------------
  | Explanation (enabled by `-explain`)
  |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  | An abstract declaration must have a return type. For example:
  |
  | trait Shape:
  |   def area: Double // abstract declaration returning a Double
   -----------------------------------------------------------------------------

The def area: Double is now also correctly colored.

Currently the output of `explain` when you are missing a return type in
an abstract declaration looks like this:

```
scala> trait Foo:
     |   def foo
-- [E019] Syntax Error: --------------------------------------------------------
2 |  def foo
  |         ^
  |         Missing return type
  |-----------------------------------------------------------------------------
  | Explanation (enabled by `-explain`)
  |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  | An abstract declaration must have a return type. For example:
  |
  | trait Shape {hl(
  |   def area: Double // abstract declaration returning a Double
  | )}
   -----------------------------------------------------------------------------
```

This fixes the interpolation issue so the return correctly shows:

```
scala> trait Foo:
     |   def foo
-- [E019] Syntax Error: --------------------------------------------------------
2 |  def foo
  |         ^
  |         Missing return type
  |-----------------------------------------------------------------------------
  | Explanation (enabled by `-explain`)
  |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  | An abstract declaration must have a return type. For example:
  |
  | trait Shape:
  |   def area: Double // abstract declaration returning a Double
   -----------------------------------------------------------------------------
```
The `def area: Double` is now also correctly colored.
@michelou
Copy link
Contributor

@ckipp01 👍

@ckipp01 ckipp01 enabled auto-merge March 29, 2022 08:35
@ckipp01 ckipp01 merged commit 7208bd8 into scala:main Mar 29, 2022
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.

3 participants