Skip to content

inline val for opaque type alias for literal type 'must have a literal constant type' #13851

Closed
@armanbilge

Description

@armanbilge

Compiler version

3.1.1-RC1

Minimized code

// This compiles:
opaque type One = 1
inline val One: One = 1

// But this does not:
opaque type Max = Int.MaxValue.type
inline val Max: Max = Int.MaxValue
// inline value must have a literal constant type

// However, this does:
inline val MaxValue: Int.MaxValue.type = Int.MaxValue

Output

[error] 33 |inline val Max: Max = Int.MaxValue
[error]    |                ^^^
[error]    |                inline value must have a literal constant type
[error] one error found

Expectation

If it is possible to inline a value of literal type Int.MaxValue, it should be possible to inline an opaque alias of that.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions