File tree 5 files changed +17
-4
lines changed
compiler/src/dotty/tools/dotc/parsing
5 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -1955,7 +1955,8 @@ object Parsers {
1955
1955
}
1956
1956
}
1957
1957
else {
1958
- if (isIdent(nme.`inline`)) mods = addModifier(mods)
1958
+ if (isIdent(nme.`inline`) && in.isSoftModifierInParamModifierPosition)
1959
+ mods = addModifier(mods)
1959
1960
mods = atPos(start) { mods | Param }
1960
1961
}
1961
1962
atPos(start, nameStart) {
@@ -2614,7 +2615,7 @@ object Parsers {
2614
2615
if (in.token == IMPLICIT || in.token == ERASED ) {
2615
2616
val start = in.offset
2616
2617
var imods = modifiers(funArgMods)
2617
- if (isBindingIntro && ! isIdent(nme.`inline`) )
2618
+ if (isBindingIntro)
2618
2619
stats += implicitClosure(start, Location .InBlock , imods)
2619
2620
else
2620
2621
stats +++= localDef(start, imods)
Original file line number Diff line number Diff line change @@ -742,6 +742,9 @@ object Scanners {
742
742
def isSoftModifierInModifierPosition : Boolean =
743
743
isSoftModifier && inModifierPosition()
744
744
745
+ def isSoftModifierInParamModifierPosition : Boolean =
746
+ isSoftModifier && ! lookaheadIn(BitSet (COLON ))
747
+
745
748
// Literals -----------------------------------------------------------------
746
749
747
750
private def getStringLit () = {
Original file line number Diff line number Diff line change @@ -3,8 +3,7 @@ layout: doc-page
3
3
title : Inline
4
4
---
5
5
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:
8
7
9
8
object Config {
10
9
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:
53
53
l / l2 // error: `/` is not a member fo Logarithm
54
54
```
55
55
56
+ ` opaque ` is a [ soft modifier] ( ./soft-modifier.html ) .
57
+
56
58
For 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 {
5
5
opaque(3 )
6
6
inline
7
7
}
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
+ }
8
16
}
You can’t perform that action at this time.
0 commit comments