-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make code completions and import suggestions work correctly for exten…
…sions with leading using clauses
- Loading branch information
Showing
5 changed files
with
246 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
-- [E008] Not Found Error: tests/neg/missing-implicit6.scala:34:8 ------------------------------------------------------ | ||
34 | "a".xxx // error, no suggested import | ||
| ^^^^^^^ | ||
| value xxx is not a member of String | ||
-- [E008] Not Found Error: tests/neg/missing-implicit6.scala:35:8 ------------------------------------------------------ | ||
35 | 123.xxx // error, suggested import | ||
| ^^^^^^^ | ||
| value xxx is not a member of Int, but could be made available as an extension method. | ||
| | ||
| The following import might fix the problem: | ||
| | ||
| import Test.Ops.xxx | ||
| | ||
-- [E008] Not Found Error: tests/neg/missing-implicit6.scala:36:8 ------------------------------------------------------ | ||
36 | 123.yyy // error, suggested import | ||
| ^^^^^^^ | ||
| value yyy is not a member of Int, but could be made available as an extension method. | ||
| | ||
| The following import might fix the problem: | ||
| | ||
| import Test.Ops.yyy | ||
| | ||
-- [E008] Not Found Error: tests/neg/missing-implicit6.scala:41:8 ------------------------------------------------------ | ||
41 | 123.xxx // error, no suggested import | ||
| ^^^^^^^ | ||
| value xxx is not a member of Int | ||
-- [E008] Not Found Error: tests/neg/missing-implicit6.scala:42:8 ------------------------------------------------------ | ||
42 | 123.yyy // error, no suggested import | ||
| ^^^^^^^ | ||
| value yyy is not a member of Int | ||
-- [E008] Not Found Error: tests/neg/missing-implicit6.scala:43:8 ------------------------------------------------------ | ||
43 | 123.zzz // error, suggested import even though there's no instance of Bar in scope | ||
| ^^^^^^^ | ||
| value zzz is not a member of Int, but could be made available as an extension method. | ||
| | ||
| The following import might fix the problem: | ||
| | ||
| import Test.Ops.zzz | ||
| |
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,45 @@ | ||
trait Foo { | ||
type Out <: { type Out } | ||
} | ||
|
||
trait Bar { | ||
type Out | ||
} | ||
|
||
object instances { | ||
given foo: Foo with { | ||
type Out = Bar | ||
} | ||
|
||
given bar: Bar with { | ||
type Out = Int | ||
} | ||
} | ||
|
||
object Test { | ||
object Ops { | ||
extension (using foo: Foo, bar: foo.Out)(i: Int) | ||
def xxx = ??? | ||
|
||
extension (using foo: Foo, fooOut: foo.Out)(x: fooOut.Out) | ||
def yyy = ??? | ||
|
||
extension (using foo: Foo)(i: Int)(using fooOut: foo.Out) | ||
def zzz = ??? | ||
} | ||
|
||
locally { | ||
import instances.given | ||
|
||
"a".xxx // error, no suggested import | ||
123.xxx // error, suggested import | ||
123.yyy // error, suggested import | ||
} | ||
|
||
locally { | ||
import instances.foo | ||
123.xxx // error, no suggested import | ||
123.yyy // error, no suggested import | ||
123.zzz // error, suggested import even though there's no instance of Bar in scope | ||
} | ||
} |