Skip to content

[null-safety] final vs. constructor throw #12560

Description

@Simn
class C {
	final s:String;

	public function new() {
		if (Math.random() > 0.5) {
			throw "no";
		} else {
			s = "foo";
		}
	}
}

Null safety: Field "s" is not nullable thus should have an initial value or should be initialized in constructor.

This is not accurate because if we get an object from the constructor the field will be assigned to.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions