-
Notifications
You must be signed in to change notification settings - Fork 285
Open
Labels
has-workaround: yesThere is a known workaroundThere is a known workaroundkind: bugCrashes, unsoundness, incorrect output, etc. If possible, add a `part:` labelCrashes, unsoundness, incorrect output, etc. If possible, add a `part:` labellang: javaDafny's Java transpiler and its runtimeDafny's Java transpiler and its runtimepart: code-generationSupport for transpiling Dafny to another language. If relevant, add a `lang:` tagSupport for transpiling Dafny to another language. If relevant, add a `lang:` tag
Description
Dafny version
4.10.1, but at least since 4.9.2
Code to produce this issue
datatype Option<A> = Some(value: A) | None()
import opened Std.BoundedInts
method M(bucket: Option<uint32>) returns (out: uint8)
requires bucket.Some?
{
out := bucket.value as uint8;
}Command to run and resulting output
dafny build --no-verify --target=java --standard-libraries
error: incompatible types: Integer cannot be converted to byte
out = ((byte) ((bucket).dtor_value()));
^
1 error
What happened?
Should compile, but a workaround is to write (bucket.value as int) as uint8.
What type of operating system are you experiencing the problem on?
Mac
Metadata
Metadata
Assignees
Labels
has-workaround: yesThere is a known workaroundThere is a known workaroundkind: bugCrashes, unsoundness, incorrect output, etc. If possible, add a `part:` labelCrashes, unsoundness, incorrect output, etc. If possible, add a `part:` labellang: javaDafny's Java transpiler and its runtimeDafny's Java transpiler and its runtimepart: code-generationSupport for transpiling Dafny to another language. If relevant, add a `lang:` tagSupport for transpiling Dafny to another language. If relevant, add a `lang:` tag