You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
namespace type_mismatch;
struct HasUint64Field
{
0: uint64 ui64_field = "this is a string value";
}
The following command runs without error and writes a .cs file.
> .\gbc.exe c# .\default_type_mismatch.bond
The .cs file is not valid however. Notice the ui64_field initialization.
...
namespace type_mismatch
{using System.Collections.Generic;[global::Bond.Schema][System.CodeDom.Compiler.GeneratedCode("gbc","3.05")]publicpartialclassHasUint64Field{[global::Bond.Id(0)]publiculongui64_field{get;set;}publicHasUint64Field(): this("type_mismatch.HasUint64Field","HasUint64Field"){}protectedHasUint64Field(stringfullName,stringname){ui64_field="this is a string value";}}}// type_mismatch
On the other hand, C++ code generation fails with the following error, though it does write _reflection.h and creates _types.h
> .\gbc.exe c++ .\default_type_mismatch.bond
gbc.exe: defaultValue: impossible happened.
Version details:
> .\gbc.exe -V
Bond Compiler 3.05, (C) Microsoft
This gbc is from Bond.CSharp 3.0.6.
The text was updated successfully, but these errors were encountered:
chwarr
changed the title
Code generation does not detect incompatible types when generating C#
Code generation does not detect default value types mismatches when generating C#
Jul 15, 2015
chwarr
changed the title
Code generation does not detect default value types mismatches when generating C#
Code generation does not detect default value type mismatches when generating C#
Jul 15, 2015
- Fail when struct field has default value of 'nothing'
- Fail when enum field doesn't have default value
- Validate aliases' default value
- Validate default value type mistmatches
- Validate default value out-of-range values
Fixes#177, fixes#164, fixes#128, fixes#73, fixes#72
- Validate default value type mistmatches (fixes#72, fixes#128)
- Validate default value out-of-range values (fixes#73)
- Fail when struct field has default value of 'nothing' (fixes#164)
- Fail when enum field doesn't have default value (fixes#177)
- Validate default value of type aliases
Given the following .bond file
The following command runs without error and writes a .cs file.
> .\gbc.exe c# .\default_type_mismatch.bond
The .cs file is not valid however. Notice the
ui64_field
initialization.On the other hand, C++ code generation fails with the following error, though it does write _reflection.h and creates _types.h
Version details:
This gbc is from Bond.CSharp 3.0.6.
The text was updated successfully, but these errors were encountered: