Skip to content

Commit f37a702

Browse files
committed
fix: preserve reserved keyword in module import diagnostic message
When a reserved keyword (e.g. 'client') is used in a module import path without the '^' escape prefix, BLangIdentifier.value is empty string while originalValue holds the raw source text. getQualifiedPackageName() was using id.value for all identifiers, causing the keyword to be silently dropped and producing misleading diagnostics like 'cannot resolve module ballerinax/.config' instead of the correct 'cannot resolve module ballerinax/client.config'. Fall back to originalValue when value is empty to preserve the keyword in the diagnostic message. Fixes: #44509, #44519
1 parent 8e1d6a6 commit f37a702

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/tree/BLangImportPackage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public String toString() {
134134
public String getQualifiedPackageName() {
135135
String orgName = this.orgName.toString();
136136
String pkgName = String.join(".", pkgNameComps.stream()
137-
.map(id -> id.value)
137+
.map(id -> id.value.isEmpty() && id.originalValue != null ? id.originalValue : id.value)
138138
.toList());
139139

140140
String versionStr = (this.version.value != null) ? this.version.value : "";

0 commit comments

Comments
 (0)