-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
inline
soft keyword (#3329)
Make `inline` a keyword when it is not part of a member selection of application. Basic idea from https://github.com/scala/vscode-scala-syntax/blob/main/src/typescript/Scala.tmLanguage.ts#L665, but without the need to distinguish the two kinds of keyword. Also see https://docs.scala-lang.org/scala3/reference/soft-modifier.html
- Loading branch information
1 parent
e91ffbd
commit c3c04d6
Showing
4 changed files
with
42 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<span class="hljs-keyword">inline</span> <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">pow</span></span>(<span class="hljs-keyword">inline</span> x: <span class="hljs-type">Int</span>, <span class="hljs-keyword">inline</span> n: <span class="hljs-type">Int</span>) = ??? | ||
transparent <span class="hljs-keyword">inline</span> <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">f</span></span>: <span class="hljs-type">Int</span> = ??? | ||
<span class="hljs-keyword">inline</span> <span class="hljs-keyword">val</span> a: <span class="hljs-type">Int</span> = <span class="hljs-number">9</span> | ||
<span class="hljs-keyword">inline</span> <span class="hljs-keyword">given</span> <span class="hljs-type">Int</span> = <span class="hljs-number">9</span> | ||
|
||
notinline <span class="hljs-keyword">given</span> <span class="hljs-type">Int</span> = <span class="hljs-number">9</span> | ||
|
||
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">expressions</span> </span>= | ||
<span class="hljs-keyword">inline</span> <span class="hljs-keyword">if</span> <span class="hljs-literal">true</span> <span class="hljs-keyword">then</span> () <span class="hljs-keyword">else</span> () | ||
<span class="hljs-keyword">inline</span> x <span class="hljs-keyword">match</span> ... | ||
|
||
x.inline | ||
x.inline(y) | ||
x.inline[<span class="hljs-type">T</span>] | ||
`inline` + <span class="hljs-number">1</span> |
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,15 @@ | ||
inline def pow(inline x: Int, inline n: Int) = ??? | ||
transparent inline def f: Int = ??? | ||
inline val a: Int = 9 | ||
inline given Int = 9 | ||
|
||
notinline given Int = 9 | ||
|
||
def expressions = | ||
inline if true then () else () | ||
inline x match ... | ||
|
||
x.inline | ||
x.inline(y) | ||
x.inline[T] | ||
`inline` + 1 |