Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enh(scala) add
using
soft keyword (#3330)
`using` is a keyword if it appears at the start of a parameter or argument list. See https://docs.scala-lang.org/scala3/reference/soft-modifier.html Based on https://github.com/scala/vscode-scala-syntax/blob/57e0829cd46980699570101a68c320a20330d36c/src/typescript/Scala.tmLanguage.ts#L504
- Loading branch information
1 parent
32bde79
commit e076acc
Showing
5 changed files
with
39 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">f</span></span>(using <span class="hljs-type">Quotes</span>) = '{ <span class="hljs-keyword">val</span> x = <span class="hljs-number">1</span>; ${g('x)} } | ||
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">f</span></span>(<span class="hljs-keyword">using</span> <span class="hljs-type">Quotes</span>) = '{ <span class="hljs-keyword">val</span> x = <span class="hljs-number">1</span>; ${g('x)} } |
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,11 @@ | ||
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">f</span></span>(<span class="hljs-keyword">using</span> x: <span class="hljs-type">Int</span>) = <span class="hljs-number">1</span> | ||
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">g</span></span>(<span class="hljs-keyword">using</span> <span class="hljs-type">Int</span>) = <span class="hljs-number">1</span> | ||
<span class="hljs-keyword">given</span> (<span class="hljs-keyword">using</span> ev: <span class="hljs-type">Ev</span>): <span class="hljs-type">Foo</span> = ??? | ||
|
||
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">expressions</span> </span>= | ||
f(<span class="hljs-keyword">using</span> <span class="hljs-number">2</span>) | ||
|
||
<span class="hljs-comment">// not `using` keyword</span> | ||
(using) | ||
(using ) | ||
( using ) |
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,11 @@ | ||
def f(using x: Int) = 1 | ||
def g(using Int) = 1 | ||
given (using ev: Ev): Foo = ??? | ||
|
||
def expressions = | ||
f(using 2) | ||
|
||
// not `using` keyword | ||
(using) | ||
(using ) | ||
( using ) |