Skip to content

[specification] do not allow lookup on optional type #172

@mrodz

Description

@mrodz

Do not allow:

class A {
    field: int
}

some_a: A? = A()

# This line can crash at runtime
some_a.field = 5

# Instead, allow this
(get some_a).field = 5
some_a!.field = 5 # if nil, will panic because there is nowhere to bubble

fn() -> int? {
    some_a!.field = 5 # if nil, will return nil
    return 70
}()

Metadata

Metadata

Assignees

Labels

compilerIssues related to compilation & parsingenhancementNew feature or request

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions