compiler: fix escape sequences in paths - #12802
Open
ogoffart wants to merge 2 commits into
Open
Conversation
The path in an import is a string literal, so decode its escape sequences
instead of only stripping the quotes. `import { X } from "b\u{61}r.slint"`
now loads bar.slint, and Unicode or emoji file names work whether written
literally or as a `\u{...}` escape. The path must stay a plain literal, so
`\{...}` interpolation is still rejected.
pathutils::join() documents that it returns a clean_path() result, but the early returns handed absolute paths back verbatim. A path with a backslash was then registered under the raw string yet looked up under the cleaned one, so get_document() missed and the type loader panicked. Fixes: #12798
ogoffart
force-pushed
the
olivier/fix-#12798
branch
from
August 6, 2026 11:11
b213938 to
25e1f37
Compare
tronical
reviewed
Aug 6, 2026
|
|
||
| Because the path is a string literal, the [escape sequences](../../property-types/strings/#string) `\"`, `\\`, `\n`, and `\u{...}` are decoded in the file name. | ||
| For example, `"caf\u{e9}.slint"` and `"café.slint"` name the same file. | ||
| String interpolation (`\{...}`) isn't available: the path must be a constant. |
Member
There was a problem hiding this comment.
Doesn't this paragraph need spec ids?
Member
Author
There was a problem hiding this comment.
it is not in Slint SC. Should it? I guess it could.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #12798