forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Demonstrate how xsbti.Problem#quickfix could be used
This requires https://github.com/smarter/sbt/tree/quickFix The following code should emit a Problem containing a quickfix replacing `f _` by `() => f`: ``` class Foo { def f: Int = { println("hi"); 1 } val g = f _ } ``` TODO: This broke -rewrite since I commented out the `patch` call, ideally they shouldn't be needed since -rewrite should be able to use the information stored in the `Message`.
- Loading branch information
Showing
8 changed files
with
78 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Zinc - The incremental compiler for Scala. | ||
* Copyright Lightbend, Inc. and Mark Harrah | ||
*/ | ||
|
||
package dotty.tools.xsbt; | ||
|
||
import dotty.tools.dotc.util.SourceFile; | ||
import dotty.tools.dotc.util.SourcePosition; | ||
import dotty.tools.io.AbstractFile; | ||
import xsbti.Position; | ||
import xsbti.TextEdit; | ||
|
||
import java.io.File; | ||
import java.util.Optional; | ||
|
||
public class TextEditBridge implements TextEdit { | ||
private final Position position; | ||
private final String newText; | ||
|
||
public TextEditBridge(Position position, String newText) { | ||
this.position = position; | ||
this.newText = newText; | ||
} | ||
|
||
@Override | ||
public Position position() { | ||
return position; | ||
} | ||
|
||
@Override | ||
public String newText() { | ||
return newText; | ||
} | ||
} |