Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Dereferencing a none value silently crashes the program #67

Open
antoniusnaumann opened this issue May 8, 2024 · 0 comments
Open

Dereferencing a none value silently crashes the program #67

antoniusnaumann opened this issue May 8, 2024 · 0 comments

Comments

@antoniusnaumann
Copy link

Currently, accessing fields from optionals that are none silently crash the program. I would have expected the compiler to give an error when dereferencing an optional.
Commit: f2107d4 (current main branch commit)

When running this program

struct Node {
	data: i64
	next: Node?
}

mut list = new Node(data: 1, next: new Node(data: 2, next: none))
println(list.next.data)

mut list2 = new Node(data: 0, next: none)

println(c"ALIVE")
println(list2.next.data)
println(c"DEAD")

it outputs

2
ALIVE

P.S.: I am aware that this project is in its early days, so if this issue is known or not relevant to the current state of this project, feel free to close it. I am curious to see how this project will evolve :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant