From 7e00c724273d432c8900c0e8ec852bb77357958e Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Mon, 6 Jun 2016 14:16:10 +0200 Subject: Fix TypeOps.featureEnabled ignoring import disabling. --- src/dotty/tools/dotc/core/TypeOps.scala | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/dotty/tools/dotc') diff --git a/src/dotty/tools/dotc/core/TypeOps.scala b/src/dotty/tools/dotc/core/TypeOps.scala index 3da119a9c..63d8dff3b 100644 --- a/src/dotty/tools/dotc/core/TypeOps.scala +++ b/src/dotty/tools/dotc/core/TypeOps.scala @@ -458,15 +458,16 @@ trait TypeOps { this: Context => // TODO: Make standalone object. if (!sym.exists || (sym eq defn.LanguageModuleClass) || (sym eq defn.Scala2LanguageModuleRef)) "" else toPrefix(sym.owner) + sym.name + "." def featureName = toPrefix(owner) + feature - def hasImport(implicit ctx: Context): Boolean = ( - ctx.importInfo != null - && ( (ctx.importInfo.site.widen.typeSymbol eq owner) - && ctx.importInfo.originals.contains(feature) - || - { var c = ctx.outer - while (c.importInfo eq ctx.importInfo) c = c.outer - hasImport(c) - })) + def hasImport(implicit ctx: Context): Boolean = { + if (ctx.importInfo == null || (ctx.importInfo.site.widen.typeSymbol ne owner)) false + else if (ctx.importInfo.excluded.contains(feature)) false + else if (ctx.importInfo.originals.contains(feature)) true + else { + var c = ctx.outer + while (c.importInfo eq ctx.importInfo) c = c.outer + hasImport(c) + } + } def hasOption = ctx.base.settings.language.value exists (s => s == featureName || s == "_") hasImport(ctx.withPhase(ctx.typerPhase)) || hasOption } -- cgit v1.2.3