apple / pkl

A configuration as code language with rich validation and tooling.
https://pkl-lang.org
Apache License 2.0
10.38k stars 280 forks source link

Semantics of Listing typechecks have changed in 0.27 #785

Open translatenix opened 2 weeks ago

translatenix commented 2 weeks ago

The following program fails in 0.26.3 but passes in 0.27.0. (My understanding is that the goal was to preserve semantics of Listing typechecks.)

local a = new Listing { new Listing { 0 } }
// 0.26.3 fails here, 0.27.0 doesn't
local b = a as Listing<Listing<String>> 
local c = (b) { new Listing { 1 } }
local d = c as Listing<Listing<Int>>

result = d
bioball commented 2 weeks ago

Ah, I think this is a regression in our typechecking logic. It shouldn't be possible to amend b and get members of type Listing<Int>.