JetBrains / JetBrains/ExternalAnnotations

Strilanc.Value.May<T>.Match() - Must never use null as second parameter

Open
#124 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
84
Forks
46
Avg merge
6h 55m
Merged PRs (30d)
1

Description

the May type from the Strilang.Value package has two overloads for the Match() function.

1. `May.Match(Func valueProjection, Func alternativeFunc)`
1. `May.Match(Func valueProjection, TOut alternativeValue)`

The first variant must not be called with `alternativeFunc` being `null`. The second may be called with null, but if written as plain code, using `null` here the compiler usually resolves it to the first variant, and by that failing at runtime.

Project on GitHub: https://github.com/Strilanc
Package in NuGet: https://www.nuget.org/packages/Strilanc.Value.May

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.