Originally created by @bioball on GitHub (Apr 6, 2024).
Currently, accessing a property of type Mapping<TypeA, TypeB> or Listing<Type> will shallow-force the whole mapping/listing. The shallow-force gets skipped if the type is unknown or Any (e.g. Listing, or Listing<unknown>, or Listing<Any>).
This should not throw, but does currently:
hidden nums: Listing<Int> = new {
throw("uh oh")
1
}
result = nums[1]
Originally created by @bioball on GitHub (Apr 6, 2024).
Currently, accessing a property of type `Mapping<TypeA, TypeB>` or `Listing<Type>` will shallow-force the whole mapping/listing. The shallow-force gets skipped if the type is `unknown` or `Any` (e.g. `Listing`, or `Listing<unknown>`, or `Listing<Any>`).
This should not throw, but does currently:
```
hidden nums: Listing<Int> = new {
throw("uh oh")
1
}
result = nums[1]
```
This is related to #405
adam
added the bug label 2025-12-30 01:21:24 +01:00
This is just another example. The addition happens and we get 33 but at what point is the type checking meant to happen. Using the IntelliJ plugin I get warnings telling me I'm doing something stupid.
foo= new Listing<YamlRenderer> {11}bar= new Listing<String> {22}
output {value= foo[0] + bar[0]renderer= new YamlRenderer{}}
output
33
@harryjackson commented on GitHub (Apr 6, 2024):
This is just another example. The addition happens and we get 33 but at what point is the type checking meant to happen. Using the IntelliJ plugin I get warnings telling me I'm doing something stupid.
```bash
foo = new Listing<YamlRenderer> {
11
}
bar = new Listing<String> {
22
}
output {
value = foo[0] + bar[0]
renderer = new YamlRenderer{}
}
```
output
```bash
33
```
@bioball commented on GitHub (Apr 7, 2024):
@harryjackson: what you're seeing is the #405 bug, rather than this one. To fix, you should add a type annotation to your properties:
```groovy
foo: Listing<YamlRenderer> = new {
11
}
bar: Listing<String> = new {
22
}
output {
value = foo[0] + bar[0]
renderer = new YamlRenderer{}
}
```
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 @bioball on GitHub (Apr 6, 2024).
Currently, accessing a property of type
Mapping<TypeA, TypeB>orListing<Type>will shallow-force the whole mapping/listing. The shallow-force gets skipped if the type isunknownorAny(e.g.Listing, orListing<unknown>, orListing<Any>).This should not throw, but does currently:
This is related to #405
@harryjackson commented on GitHub (Apr 6, 2024):
This is just another example. The addition happens and we get 33 but at what point is the type checking meant to happen. Using the IntelliJ plugin I get warnings telling me I'm doing something stupid.
output
@bioball commented on GitHub (Apr 7, 2024):
@harryjackson: what you're seeing is the #405 bug, rather than this one. To fix, you should add a type annotation to your properties: