Fix KonanTest to correctly replace packages when test contains function parameters with the same name as package

This commit is contained in:
Pavel Punegov
2018-09-19 17:23:05 +03:00
committed by Pavel Punegov
parent db15656cbe
commit e8a2c58759
@@ -791,7 +791,8 @@ class RunExternalTestGroup extends RunStandaloneKonanTest {
def vars = new HashSet<String>() // variables that has the same name as a package
text.eachLine { line ->
packages.each { pkg ->
if (line =~ ~/va(l|r) *$pkg *\=/) {
// line contains val or var declaration or function parameter declaration
if ((line =~ ~/va(l|r) *$pkg *\=/) || (line =~ ~/fun .*\(\n?\s*$pkg:.*/)) {
vars.add(pkg)
}
if (line.contains("$pkg.") && ! (line =~ packagePattern || line =~ importRegex)