Originally created by @HT154 on GitHub (Jan 31, 2025).
Given input
class Thing {
a: Int
b: Int
function toString(): String = "\(a):\(b)"
}
local thingListing = new Listing<Thing> {
new { a = 10; b = 20 }
new { a = 30; b = 40 }
}
local thingList = thingListing.toList()
resultListing = thingListing.join("\n")
resultList = thingList.join("\n")
resultListing = """
new Thing { a = 10; b = 20 }
new Thing { a = 30; b = 40 }
"""
resultList = """
new Thing { a = 10; b = 20 }
new Thing { a = 30; b = 40 }
"""
Other instances where Pkl can convert arbitrary values to String (i.e. string interpolation) correctly call the value's toString() method.
Originally created by @HT154 on GitHub (Jan 31, 2025).
Given input
```pkl
class Thing {
a: Int
b: Int
function toString(): String = "\(a):\(b)"
}
local thingListing = new Listing<Thing> {
new { a = 10; b = 20 }
new { a = 30; b = 40 }
}
local thingList = thingListing.toList()
resultListing = thingListing.join("\n")
resultList = thingList.join("\n")
```
The expected output is
```pkl
resultListing = """
10:20
30:30
"""
resultList = """
10:20
30:30
"""
```
The actual output is
```pkl
resultListing = """
new Thing { a = 10; b = 20 }
new Thing { a = 30; b = 40 }
"""
resultList = """
new Thing { a = 10; b = 20 }
new Thing { a = 30; b = 40 }
"""
```
Other instances where Pkl can convert arbitrary values to `String` (i.e. string interpolation) correctly call the value's `toString()` method.
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 @HT154 on GitHub (Jan 31, 2025).
Given input
The expected output is
The actual output is
Other instances where Pkl can convert arbitrary values to
String(i.e. string interpolation) correctly call the value'stoString()method.@bioball commented on GitHub (Feb 3, 2025):
This seems like a bug to me.
This would also be a breaking change if fixed.