Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweaks to indent syntax #7363

Merged
merged 16 commits into from Oct 10, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -49,9 +49,6 @@ object desugar {
case None, Exhaustive, IrrefutablePatDef, IrrefutableGenFrom
}

/** Info of a variable in a pattern: The named tree and its type */
private type VarInfo = (NameTree, Tree)

/** Is `name` the name of a method that can be invalidated as a compiler-generated
* case class method if it clashes with a user-defined method?
*/
@@ -1685,16 +1682,6 @@ object desugar {
TypeDef(tpnme.REFINE_CLASS, impl).withFlags(Trait)
}

/** If tree is of the form `id` or `id: T`, return its name and type, otherwise return None.
*/
private object IdPattern {
def unapply(tree: Tree)(implicit ctx: Context): Option[VarInfo] = tree match {
case id: Ident if id.name != nme.WILDCARD => Some(id, TypeTree())
case Typed(id: Ident, tpt) => Some((id, tpt))
case _ => None
}
}

/** Returns list of all pattern variables, possibly with their types,
* without duplicates
*/
@@ -345,6 +345,18 @@ trait UntypedTreeInfo extends TreeInfo[Untyped] { self: Trees.Instance[Untyped]
def bodyKind(body: List[Tree])(implicit ctx: Context): FlagSet =
body.foldLeft(NoInitsInterface)((fs, stat) => fs & defKind(stat))

/** Info of a variable in a pattern: The named tree and its type */
type VarInfo = (NameTree, Tree)

/** An extractor for trees of the form `id` or `id: T` */
object IdPattern {
def unapply(tree: Tree)(implicit ctx: Context): Option[VarInfo] = tree match {
case id: Ident if id.name != nme.WILDCARD => Some(id, TypeTree())
case Typed(id: Ident, tpt) => Some((id, tpt))
case _ => None
}
}

// todo: fill with other methods from TreeInfo that only apply to untpd.Tree's
}

@@ -160,6 +160,9 @@ object Config {
/** Assume -indent by default */
final val defaultIndent = true

/** Assume indentation is significant after a class, object, ... signature */
final val silentTemplateIndent = true

/** If set, prints a trace of all symbol completions */
final val showCompletions = false

@@ -832,11 +832,12 @@ object SymDenotations {
| Access to protected $this not permitted because enclosing ${ctx.owner.enclosingClass.showLocated}
| is not a subclass of ${owner.showLocated} where target is defined""")
else if
(!( isType // allow accesses to types from arbitrary subclasses fixes #4737
!( isType // allow accesses to types from arbitrary subclasses fixes #4737
|| pre.derivesFrom(cls)
|| isConstructor
|| owner.is(ModuleClass) // don't perform this check for static members
))
)
then
fail(
i"""
| Access to protected ${symbol.show} not permitted because prefix type ${pre.widen.show}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.