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

Show inlined positions with source code #14002

Merged
merged 1 commit into from
Feb 2, 2022

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Nov 25, 2021

This gives more context to the users on what happened and where the code came from.

This also fixes a couple of kinks in formatting.

Example

trait Foo[X]:
  def foo: Int

def foo =
  first[String]

inline def second[A]: Int =
  compiletime.summonInline[Foo[A]].foo

inline def first[A]: Int =
  second[A] + 42

Now

Screenshot 2022-01-26 at 17 48 21

Before

Screenshot 2022-01-26 at 17 47 21

@nicolasstucki nicolasstucki self-assigned this Nov 25, 2021
@nicolasstucki nicolasstucki force-pushed the fix-13991 branch 3 times, most recently from 2daaa03 to b3a0cc6 Compare December 17, 2021 10:44
@nicolasstucki nicolasstucki force-pushed the fix-13991 branch 2 times, most recently from 833201e to ba9d101 Compare January 4, 2022 08:53
@nicolasstucki nicolasstucki force-pushed the fix-13991 branch 3 times, most recently from 0ee20f9 to 96bf85e Compare January 13, 2022 15:34
@nicolasstucki nicolasstucki marked this pull request as ready for review January 26, 2022 09:28
@nicolasstucki nicolasstucki force-pushed the fix-13991 branch 3 times, most recently from 9a53c1c to 9e8c5af Compare January 26, 2022 15:29
@nicolasstucki nicolasstucki force-pushed the fix-13991 branch 2 times, most recently from 92f8515 to 3756e4f Compare January 27, 2022 09:38
This gives more context to the users on what happen and where the code came from.
Copy link
Contributor

@anatoliykmetyuk anatoliykmetyuk left a comment

Choose a reason for hiding this comment

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

Nice feature, LGTM!

@anatoliykmetyuk anatoliykmetyuk merged commit e45dd62 into scala:main Feb 2, 2022
@anatoliykmetyuk anatoliykmetyuk deleted the fix-13991 branch February 2, 2022 14:22
@smarter smarter added the release-notes Should be mentioned in the release notes label Feb 2, 2022
ckipp01 added a commit to ckipp01/sbt that referenced this pull request Apr 10, 2022
This PR makes changes to the existing `xsbti.Problem` to account for an
optional diagnostic code that the compiler can return for a given
diagnostic and also related information.

Given a piece of code like:

```scala
try {}
```

You'll receive the following:

```
-- [E002] Syntax Warning: /Users/ckipp/Documents/scala-workspace/dotty-error-index/examples/002_EmptyCatchAndFinallyBlockID.scala:3:2
3 |  try {}
  |  ^^^^^^
  |  A try without catch or finally is equivalent to putting
  |  its body in a block; no exceptions are handled.
```

The `E002` here is the actual code. Right now there would be no
description.

Some diagnostics have multiple positions that they need to represent.
You can see an example of this
[here](scala/scala3#14002) in Dotty with the
use of inlining. Instead of needing to rely on including all of that
information in the diagnostic message it can now be extracted out into
a `DiagnosticRelatedInformation`.

These changes reference the conversation in sbt#6868
ckipp01 added a commit to ckipp01/sbt that referenced this pull request Apr 12, 2022
This PR makes changes to the existing `xsbti.Problem` to account for an
optional diagnostic code that the compiler can return for a given
diagnostic and also related information.

Given a piece of code like:

```scala
try {}
```

You'll receive the following:

```
-- [E002] Syntax Warning: /Users/ckipp/Documents/scala-workspace/dotty-error-index/examples/002_EmptyCatchAndFinallyBlockID.scala:3:2
3 |  try {}
  |  ^^^^^^
  |  A try without catch or finally is equivalent to putting
  |  its body in a block; no exceptions are handled.
```

The `E002` here is the actual code. Right now there would be no
description.

Some diagnostics have multiple positions that they need to represent.
You can see an example of this
[here](scala/scala3#14002) in Dotty with the
use of inlining. Instead of needing to rely on including all of that
information in the diagnostic message it can now be extracted out into
a `DiagnosticRelatedInformation`.

These changes reference the conversation in sbt#6868
ckipp01 added a commit to ckipp01/sbt that referenced this pull request Apr 12, 2022
This PR makes changes to the existing `xsbti.Problem` to account for an
optional diagnostic code that the compiler can return for a given
diagnostic and also related information.

Given a piece of code like:

```scala
try {}
```

You'll receive the following:

```
-- [E002] Syntax Warning: /Users/ckipp/Documents/scala-workspace/dotty-error-index/examples/002_EmptyCatchAndFinallyBlockID.scala:3:2
3 |  try {}
  |  ^^^^^^
  |  A try without catch or finally is equivalent to putting
  |  its body in a block; no exceptions are handled.
```

The `E002` here is the actual code. Right now there would be no
description.

Some diagnostics have multiple positions that they need to represent.
You can see an example of this
[here](scala/scala3#14002) in Dotty with the
use of inlining. Instead of needing to rely on including all of that
information in the diagnostic message it can now be extracted out into
a `DiagnosticRelatedInformation`.

These changes reference the conversation in sbt#6868
ckipp01 added a commit to ckipp01/sbt that referenced this pull request Apr 12, 2022
This PR makes changes to the existing `xsbti.Problem` to account for an
optional diagnostic code that the compiler can return for a given
diagnostic and also related information.

Given a piece of code like:

```scala
try {}
```

You'll receive the following:

```
-- [E002] Syntax Warning: /Users/ckipp/Documents/scala-workspace/dotty-error-index/examples/002_EmptyCatchAndFinallyBlockID.scala:3:2
3 |  try {}
  |  ^^^^^^
  |  A try without catch or finally is equivalent to putting
  |  its body in a block; no exceptions are handled.
```

The `E002` here is the actual code. Right now there would be no
description.

Some diagnostics have multiple positions that they need to represent.
You can see an example of this
[here](scala/scala3#14002) in Dotty with the
use of inlining. Instead of needing to rely on including all of that
information in the diagnostic message it can now be extracted out into
a `DiagnosticRelatedInformation`.

These changes reference the conversation in sbt#6868
ckipp01 added a commit to ckipp01/sbt that referenced this pull request Apr 12, 2022
This PR makes changes to the existing `xsbti.Problem` to account for an
optional diagnostic code that the compiler can return for a given
diagnostic and also related information.

Given a piece of code like:

```scala
try {}
```

You'll receive the following:

```
-- [E002] Syntax Warning: /Users/ckipp/Documents/scala-workspace/dotty-error-index/examples/002_EmptyCatchAndFinallyBlockID.scala:3:2
3 |  try {}
  |  ^^^^^^
  |  A try without catch or finally is equivalent to putting
  |  its body in a block; no exceptions are handled.
```

The `E002` here is the actual code. Right now there would be no
description.

Some diagnostics have multiple positions that they need to represent.
You can see an example of this
[here](scala/scala3#14002) in Dotty with the
use of inlining. Instead of needing to rely on including all of that
information in the diagnostic message it can now be extracted out into
a `DiagnosticRelatedInformation`.

These changes reference the conversation in sbt#6868
ckipp01 added a commit to ckipp01/sbt that referenced this pull request Apr 12, 2022
This PR makes changes to the existing `xsbti.Problem` to account for an
optional diagnostic code that the compiler can return for a given
diagnostic and also related information.

Given a piece of code like:

```scala
try {}
```

You'll receive the following:

```
-- [E002] Syntax Warning: /Users/ckipp/Documents/scala-workspace/dotty-error-index/examples/002_EmptyCatchAndFinallyBlockID.scala:3:2
3 |  try {}
  |  ^^^^^^
  |  A try without catch or finally is equivalent to putting
  |  its body in a block; no exceptions are handled.
```

The `E002` here is the actual code. Right now there would be no
description.

Some diagnostics have multiple positions that they need to represent.
You can see an example of this
[here](scala/scala3#14002) in Dotty with the
use of inlining. Instead of needing to rely on including all of that
information in the diagnostic message it can now be extracted out into
a `DiagnosticRelatedInformation`.

These changes reference the conversation in sbt#6868
@Kordyjan Kordyjan added this to the 3.1.3 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes Should be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect position of error reported from macro in inline methods chain
4 participants