Open tsuf239 opened 1 year ago
optional_map?.get("property")
should actually work - it is just not implemented yet - see #436
Hi,
This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!
Hi,
This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!
An example for this error message:
let m: Map<str>? = {"a" => "aaa"};
log(m?.get("a"));
Yields the following compile time error message:
error: Expected type to be "str", but got "str?" instead
The error message should direct the user to unwrap the optional value (by using if let
or the ??
operator).
Hi,
This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!
Hi,
This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!
Feature Spec
Assuming we have an optional Map, and we want to access one of its properties,?"
this error message might not be clear enough to guide the user on how to fix the error.
optional_map.get("property")
(or evenoptional_map?.get("property")
) will throw the following error: "property access unsupported on type Map(At the end I solved it this way:
)
Use Cases
accessing a property on an optional map
Implementation Notes
We will also support
optional_map?.property
in the futureComponent
Language Design
Community Note