File tree Expand file tree Collapse file tree 5 files changed +17
-4
lines changed
compiler/src/dotty/tools/dotc/parsing Expand file tree Collapse file tree 5 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -1955,7 +1955,8 @@ object Parsers {
19551955 }
19561956 }
19571957 else {
1958- if (isIdent(nme.`inline`)) mods = addModifier(mods)
1958+ if (isIdent(nme.`inline`) && in.isSoftModifierInParamModifierPosition)
1959+ mods = addModifier(mods)
19591960 mods = atPos(start) { mods | Param }
19601961 }
19611962 atPos(start, nameStart) {
@@ -2614,7 +2615,7 @@ object Parsers {
26142615 if (in.token == IMPLICIT || in.token == ERASED ) {
26152616 val start = in.offset
26162617 var imods = modifiers(funArgMods)
2617- if (isBindingIntro && ! isIdent(nme.`inline`) )
2618+ if (isBindingIntro)
26182619 stats += implicitClosure(start, Location .InBlock , imods)
26192620 else
26202621 stats +++= localDef(start, imods)
Original file line number Diff line number Diff line change @@ -742,6 +742,9 @@ object Scanners {
742742 def isSoftModifierInModifierPosition : Boolean =
743743 isSoftModifier && inModifierPosition()
744744
745+ def isSoftModifierInParamModifierPosition : Boolean =
746+ isSoftModifier && ! lookaheadIn(BitSet (COLON ))
747+
745748// Literals -----------------------------------------------------------------
746749
747750 private def getStringLit () = {
Original file line number Diff line number Diff line change @@ -3,8 +3,7 @@ layout: doc-page
33title : Inline
44---
55
6- ` inline ` is a new modifier that guarantees that a definition will be
7- inline at the point of use. Example:
6+ ` inline ` is a new [ soft modifier] ( ./soft-modifier.html ) that guarantees that a definition will be inline at the point of use. Example:
87
98 object Config {
109 inline val logging = false
Original file line number Diff line number Diff line change @@ -53,4 +53,6 @@ But the following operations would lead to type errors:
5353 l / l2 // error: `/` is not a member fo Logarithm
5454```
5555
56+ ` opaque ` is a [ soft modifier] ( ./soft-modifier.html ) .
57+
5658For more details, see [ Scala SIP 35] ( https://docs.scala-lang.org/sips/opaque-types.html ) .
Original file line number Diff line number Diff line change @@ -5,4 +5,12 @@ class Test {
55 opaque(3 )
66 inline
77 }
8+ def bar (inline : Int => Int ) = 3
9+ inline def baz (inline x : Int => Int ) = 3
10+
11+ locally {
12+ bar(inline = identity)
13+ bar(inline => inline)
14+ bar(implicit inline => inline)
15+ }
816}
You can’t perform that action at this time.
0 commit comments