From 9d4b2f2dbdebe467c9628046aadf37afbb3444ad Mon Sep 17 00:00:00 2001 From: Mark Hills Date: Tue, 19 Apr 2016 09:18:32 -0400 Subject: [PATCH] Now allow for names to be included as exceptions in scope conflict rules, resolves #947 --- src/org/rascalmpl/library/lang/rascal/types/CheckTypes.rsc | 2 +- src/org/rascalmpl/library/lang/rascal/types/CheckerConfig.rsc | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/org/rascalmpl/library/lang/rascal/types/CheckTypes.rsc b/src/org/rascalmpl/library/lang/rascal/types/CheckTypes.rsc index f27cb3135ac..b360cb8e52c 100644 --- a/src/org/rascalmpl/library/lang/rascal/types/CheckTypes.rsc +++ b/src/org/rascalmpl/library/lang/rascal/types/CheckTypes.rsc @@ -296,7 +296,7 @@ public CheckResult checkExp(Expression exp:(Expression)`( | = checkExp(er, cRed); if (!isFailType(t3)) { if (!equivalent(erType,t3) && lub(erType,t3) == t3) { diff --git a/src/org/rascalmpl/library/lang/rascal/types/CheckerConfig.rsc b/src/org/rascalmpl/library/lang/rascal/types/CheckerConfig.rsc index aa0887471c9..7d1384672fe 100644 --- a/src/org/rascalmpl/library/lang/rascal/types/CheckerConfig.rsc +++ b/src/org/rascalmpl/library/lang/rascal/types/CheckerConfig.rsc @@ -339,7 +339,7 @@ public Configuration addImportedVariable(Configuration c, RName n, int varId, bo } @doc{Add a new local variable into the configuration.} -public Configuration addLocalVariable(Configuration c, RName n, bool inf, loc l, Symbol rt) { +public Configuration addLocalVariable(Configuration c, RName n, bool inf, loc l, Symbol rt, set[RName] allowedConflicts = { }) { moduleId = head([i | i <- c.stack, c.store[i] is \module]); moduleName = c.store[moduleId].name; @@ -358,6 +358,8 @@ public Configuration addLocalVariable(Configuration c, RName n, bool inf, loc l, if (n notin c.fcvEnv) { c.fcvEnv[n] = varId; + } else if (n in c.fcvEnv && n in allowedConflicts) { + c.fcvEnv[n] = varId; } else { // The name is already defined: what items are defined by this name? conflictIds = (overload(ids,_) := c.store[c.fcvEnv[n]]) ? ids : { c.fcvEnv[n] };