Originally created by @nikeokoronkwo on GitHub (Dec 23, 2024).
Overview
Apparently, Pkl crashes when Regex inputs have some sort of string interpolation or joining (adding strings together) in the constructor. I understand that Apple Pkl Regex input types are based on Java Regex Syntax, but they support combining strings in the format of a + b + c, while Apple Pkl crashes on either occasions.
Problem
This was the function implemented for this case
local function typeRegex(name: String) Regex = Regex("./src/([A-Za-z]+)/" + name + ".pkl")
And this was the error message received, even without implementing the function (in a variable or item for instance).
An unexpected error has occurred. Would you mind filing a bug report?
Info/Context
Pkl Version (via pkl --version): 0.26.1
Originally created by @nikeokoronkwo on GitHub (Dec 23, 2024).
## Overview
Apparently, Pkl crashes when `Regex` inputs have some sort of string interpolation or joining (adding strings together) in the constructor. I understand that Apple Pkl `Regex` input types are based on Java Regex Syntax, but they support combining strings in the format of `a + b + c`, while Apple Pkl crashes on either occasions.
## Problem
This was the function implemented for this case
```pkl
local function typeRegex(name: String) Regex = Regex("./src/([A-Za-z]+)/" + name + ".pkl")
```
And this was the error message received, even without implementing the function (in a variable or item for instance).
```log
An unexpected error has occurred. Would you mind filing a bug report?
```
## Info/Context
- Pkl Version (via `pkl --version`): 0.26.1
I'm not able to reproduce this on Pkl 0.27.1 (the current release). Given module:
local function typeRegex(name: String): Regex = Regex("./src/([A-Za-z]+)/" + name + ".pkl")
// ^ note this missing colon from your snippet
x = typeRegex("abc").findMatchesIn("./src/abcDEF/abc.pkl").length
y = typeRegex("abc").findMatchesIn("./src/abcDEF/def.pkl").length
As expected, this evaluates to:
x = 1
y = 0
Can you try again on the latest release? If you're still seeing issues, can you share a more complete repro?
@HT154 commented on GitHub (Dec 23, 2024):
I'm not able to reproduce this on Pkl 0.27.1 (the current release). Given module:
```pkl
local function typeRegex(name: String): Regex = Regex("./src/([A-Za-z]+)/" + name + ".pkl")
// ^ note this missing colon from your snippet
x = typeRegex("abc").findMatchesIn("./src/abcDEF/abc.pkl").length
y = typeRegex("abc").findMatchesIn("./src/abcDEF/def.pkl").length
```
As expected, this evaluates to:
```pkl
x = 1
y = 0
```
Can you try again on the latest release? If you're still seeing issues, can you share a more complete repro?
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @nikeokoronkwo on GitHub (Dec 23, 2024).
Overview
Apparently, Pkl crashes when
Regexinputs have some sort of string interpolation or joining (adding strings together) in the constructor. I understand that Apple PklRegexinput types are based on Java Regex Syntax, but they support combining strings in the format ofa + b + c, while Apple Pkl crashes on either occasions.Problem
This was the function implemented for this case
And this was the error message received, even without implementing the function (in a variable or item for instance).
Info/Context
pkl --version): 0.26.1@HT154 commented on GitHub (Dec 23, 2024):
I'm not able to reproduce this on Pkl 0.27.1 (the current release). Given module:
As expected, this evaluates to:
Can you try again on the latest release? If you're still seeing issues, can you share a more complete repro?
@nikeokoronkwo commented on GitHub (Dec 23, 2024):
Oh, my bad. Must've been the colon
Sorry about that
@odenix commented on GitHub (Dec 24, 2024):
The "unexpected error" message is clearly a bug (possibly fixed by https://github.com/apple/pkl/pull/837).
@bioball commented on GitHub (Jan 17, 2025):
I haven't been able to reproduce this; closing this. Please comment if you are still seeing this.