scala/scala — pull request #2659 by retronym (2013-06-18 21:08:18+00:00)
Title: SI-7584 Fix typer regression with by-name parameter types

It regressed in fada1ef#L4L614. Partially reverting just
this change restores the correct behaviour:

```
- if (sym.isStable && pre.isStable && !isByNameParamType(tree.tpe) &&
+ if (treeInfo.admitsTypeSelection(tree) &&
```

This patch embeds the check for by-name parameter types into
`TreeInfo.isStableIdentifier`. That code already checks for
`Symbol#isStable`, which exludes direct references to by-name
parameters. But the additional check is required to deal with
by-name parameters in function types, e.g `(=> Int) => Any`.

Open question: should we go further and embed this check in `isStable`?

Currently:

final def isStable = isTerm && !isMutable && !(hasFlag(BYNAMEPARAM)) && (!isMethod || hasStableFlag)

Review by @adriaanm