`Listing.join` and `List.join` do not call `toString` override on elements
- Dominant language
- Java
- Stars
- 11.5k
- Forks
- 402
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 20
Description
Given input
```pkl
class Thing {
a: Int
b: Int
function toString(): String = "\(a):\(b)"
}
local thingListing = new Listing {
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.
Contributor guide
Research direction
Start by locating the implementations of Listing.join and List.join, then compare their value-to-string behavior with the string interpolation behavior described in the issue. The work is done when both join methods invoke each element's toString override and the supplied example produces the expected output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100