diff options
author | Martin Odersky <odersky@gmail.com> | 2016-10-14 15:11:48 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-10-14 15:11:57 +0200 |
commit | 652cce0b0ad1b8b54f54a5d78a6c4defbd599124 (patch) | |
tree | f59f6a935387b744189f00524fd34ecfbdfe9ad0 /src/dotty/tools/dotc/typer/Checking.scala | |
parent | 8bfaadaae141e83db7f515b042fcee26ed0e54fd (diff) | |
download | dotty-652cce0b0ad1b8b54f54a5d78a6c4defbd599124.tar.gz dotty-652cce0b0ad1b8b54f54a5d78a6c4defbd599124.tar.bz2 dotty-652cce0b0ad1b8b54f54a5d78a6c4defbd599124.zip |
Fix #1570: Allow inline parameters as inline args
Inline parameters can always be passed to other
inline parameters.
Fixes #1570.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Checking.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Checking.scala | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/typer/Checking.scala b/src/dotty/tools/dotc/typer/Checking.scala index 7899174f5..3ebae733f 100644 --- a/src/dotty/tools/dotc/typer/Checking.scala +++ b/src/dotty/tools/dotc/typer/Checking.scala @@ -482,10 +482,13 @@ trait Checking { /** Check that `tree` is a pure expression of constant type */ def checkInlineConformant(tree: Tree, what: => String)(implicit ctx: Context): Unit = - tree.tpe.widenTermRefExpr match { - case tp: ConstantType if isPureExpr(tree) => // ok - case tp if defn.isFunctionType(tp) && isPureExpr(tree) => // ok - case _ => ctx.error(em"$what must be a constant expression or a function", tree.pos) + tree.tpe match { + case tp: TermRef if tp.symbol.is(InlineParam) => // ok + case tp => tp.widenTermRefExpr match { + case tp: ConstantType if isPureExpr(tree) => // ok + case tp if defn.isFunctionType(tp) && isPureExpr(tree) => // ok + case _ => ctx.error(em"$what must be a constant expression or a function", tree.pos) + } } /** Check that class does not define same symbol twice */ |