From 550ac7dcfb8d691ba5575c7e4a1cdf76dc8ceece Mon Sep 17 00:00:00 2001 From: Davy Landman Date: Tue, 18 Aug 2026 16:50:56 +0200 Subject: [PATCH 1/2] Using latest vallang that normalizes scheme and authorities --- pom.xml | 2 +- .../library/lang/rascal/tests/basic/Locations.rsc | 15 +++++++++------ .../rascalmpl/uri/file/SystemPathURIResolver.java | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index eed57e9c1e8..8d6c46478bb 100644 --- a/pom.xml +++ b/pom.xml @@ -472,7 +472,7 @@ io.usethesource vallang - 1.0.1-RC1 + 1.1.0-RC1 org.apache.commons diff --git a/src/org/rascalmpl/library/lang/rascal/tests/basic/Locations.rsc b/src/org/rascalmpl/library/lang/rascal/tests/basic/Locations.rsc index ca0af494ebd..16fdc12ac6b 100644 --- a/src/org/rascalmpl/library/lang/rascal/tests/basic/Locations.rsc +++ b/src/org/rascalmpl/library/lang/rascal/tests/basic/Locations.rsc @@ -29,11 +29,14 @@ str createValidScheme(str s) { @expected{MalFormedURI} test bool noOpaqueURI2() = loc _ := |home:://this:is:opaque|; -test bool canChangeScheme1(loc l, str s) = (l[scheme = createValidScheme(s)]).scheme == createValidScheme(s); -test bool canChangeScheme2(loc l, str s) { l.scheme = createValidScheme(s); return l.scheme == createValidScheme(s); } +str lowerCaseHost(/^@$/) = "@"; +default str lowerCaseHost(str auth) = toLowerCase(auth); -test bool canChangeAuthority1(loc l, str s) = (l[authority = s]).authority == s; -test bool canChangeAuthority2(loc l, str s) { l.authority = s; return l.authority == s; } +test bool canChangeScheme1(loc l, str s) = (l[scheme = createValidScheme(s)]).scheme == toLowerCase(createValidScheme(s)); +test bool canChangeScheme2(loc l, str s) { l.scheme = createValidScheme(s); return l.scheme == toLowerCase(createValidScheme(s)); } + +test bool canChangeAuthority1(loc l, str s) = (l[authority = s]).authority == lowerCaseHost(s); +test bool canChangeAuthority2(loc l, str s) { l.authority = s; return l.authority == lowerCaseHost(s); } str fixPath(str s) = visit (s) { case /\/\/+/ => "/" }; @@ -53,8 +56,8 @@ str createValidHost(str s) { return ("a.a" | it + stringChar(validHostChars[c % size(validHostChars)]) | c <- chars(s)) + "a.com"; } -test bool canChangeHost1(loc l, str s) = (l[scheme="http"][authority="a"][host = createValidHost(s)]).host == createValidHost(s); -test bool canChangeHost2(loc l, str s) { l.scheme="http"; l.authority = "a"; l.host = createValidHost(s); return l.host == createValidHost(s); } +test bool canChangeHost1(loc l, str s) = (l[scheme="http"][authority="a"][host = createValidHost(s)]).host == toLowerCase(createValidHost(s)); +test bool canChangeHost2(loc l, str s) { l.scheme="http"; l.authority = "a"; l.host = createValidHost(s); return l.host == toLowerCase(createValidHost(s)); } test bool canChangeUser1(loc l, str s) = contains(s, "@") || (l[scheme="http"][authority="a@a.com"][user = s]).user == s; test bool canChangeUser2(loc l, str s) { if (contains(s, "@")) return true; l.scheme="http"; l.authority = "a@a.com"; l.user = s; if ( l.user == s) { return true; } else {println(" != "); return false; } } diff --git a/src/org/rascalmpl/uri/file/SystemPathURIResolver.java b/src/org/rascalmpl/uri/file/SystemPathURIResolver.java index 4a8f4abc6d2..3cb81070077 100644 --- a/src/org/rascalmpl/uri/file/SystemPathURIResolver.java +++ b/src/org/rascalmpl/uri/file/SystemPathURIResolver.java @@ -29,7 +29,7 @@ public class SystemPathURIResolver implements ILogicalSourceLocationResolver { @Override public String scheme() { - return "PATH"; + return "path"; } From 410ea1b1ed439d8b4dc4584f3e88e6e82329f866 Mon Sep 17 00:00:00 2001 From: Davy Landman Date: Tue, 18 Aug 2026 17:29:14 +0200 Subject: [PATCH 2/2] Make sure that . also matches newlines etc --- src/org/rascalmpl/library/lang/rascal/tests/basic/Locations.rsc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/rascalmpl/library/lang/rascal/tests/basic/Locations.rsc b/src/org/rascalmpl/library/lang/rascal/tests/basic/Locations.rsc index 16fdc12ac6b..808066e2157 100644 --- a/src/org/rascalmpl/library/lang/rascal/tests/basic/Locations.rsc +++ b/src/org/rascalmpl/library/lang/rascal/tests/basic/Locations.rsc @@ -29,7 +29,7 @@ str createValidScheme(str s) { @expected{MalFormedURI} test bool noOpaqueURI2() = loc _ := |home:://this:is:opaque|; -str lowerCaseHost(/^@$/) = "@"; +str lowerCaseHost(/(?s)^@$/) = "@"; default str lowerCaseHost(str auth) = toLowerCase(auth); test bool canChangeScheme1(loc l, str s) = (l[scheme = createValidScheme(s)]).scheme == toLowerCase(createValidScheme(s));