<!-- %default %useHeadings %check-ids -->

<!-- The file Errors-Compiler.template is used along with Compiler-Errors.cs to produce Errors-Compiler.md.
     Errors-Compiler.template holds the structure of the markdown file and the examples of each error message.
     Compiler-Errors.cs holds the text of error explanations, so they are just in the source code rather than duplicated also in markdown.
     The content of Errors-Compiler.template and Compiler-Errors.cs are tied together by the errorids.
     Thus Errors-Compiler.md is a generated file that should not be edited itself.
     The program make-error-catalog does the file generation.
-->

<!-- DafnyCore/Compilers/ExecutableBackend.cs -->

## **Error: _process_ Process exited with exit code _code_** {#c_process_exit}

<!-- INSERT-TEXT -->

## **Error: Unable to start _target_** {#c_process_failed_to_start}

<!-- INSERT-TEXT -->

<!-- DafnyCore/Compilers/SinglePassCompiler.cs -->

## **Error: Error: '_feature_' is not an element of the _target_ compiler's UnsupportedFeatures set** {#c_unsupported_feature}

<!-- INSERT-TEXT -->

## **Error: Abstract type ('_type_') with extern attribute requires a compile hint. Expected {:extern _hint_}** {#c_abstract_type_needs_hint}

<!-- %check-run -->
```dafny
type {:extern } T
```

<!-- INSERT-TEXT -->

## **Error: Abstract type (_name_) cannot be compiled; perhaps make it a type synonym or use :extern.** {#c_abstract_type_cannot_be_compiled}

<!-- %check-run -->
```dafny
type T
```

<!-- INSERT-TEXT -->

## **Error: since yield parameters are initialized arbitrarily, iterators are forbidden by the --enforce-determinism option** {#c_iterators_are_not_deterministic}

<!-- %check-resolve %options --enforce-determinism -->
```dafny
iterator Gen(start: int) yields (x: int)
  yield ensures |xs| <= 10 && x == start + |xs| - 1
{
  var i := 0;
  while i < 10 invariant |xs| == i {
    x := start + i;
    yield;
    i := i + 1;
  }
}
```

<!-- INSERT-TEXT -->

## **Error: iterator _name_ has no body** {#c_iterator_has_no_body}

<!-- %check-run -->
```dafny
iterator Gen(start: int) yields (x: int)
  yield ensures |xs| <= 10 && x == start + |xs| - 1
```

<!-- INSERT-TEXT -->

## **Error: since fields are initialized arbitrarily, constructor-less classes are forbidden by the --enforce-determinism option** {#c_constructorless_class_forbidden}

<!-- %check-resolve %options --enforce-determinism -->
```dafny
class A { var j: int }
```

<!-- INSERT-TEXT -->

## **Error: The method '_name_' is not permitted as a main method (_reason_).** {#c_method_may_not_be_main_method}

<!-- %check-run %options --main-method:mmm -->
```dafny
method mmm(i: int) {}
```

<!-- INSERT-TEXT -->

## **Error: Could not find the method named by the -Main option: _name_** {#c_could_not_find_stipulated_main_method}

<!-- %check-run %options --main-method:m -->
```dafny
class A { static method mm() {} }
```

<!-- INSERT-TEXT -->

## **Error: More than one method is marked {:main}. First declaration appeared at _location_.** {#c_more_than_one_explicit_main_method}

<!-- %check-run -->
```dafny
method {:main} M(s: seq<string>) {}
method {:main} P() {}
```

<!-- INSERT-TEXT -->

## **Error: This method marked {:main} is not permitted as a main method (_name_).** {#c_method_not_permitted_as_main}

<!-- %check-run -->
```dafny
method {:main} M(i: int) {}
```

<!-- INSERT-TEXT -->

## **Error: More than one method is declared as 'Main'. First declaration appeared at _location_.** {#c_more_than_one_default_Main_method}

<!-- %check-run -->
```dafny
method Main(s: seq<string>) {}
class A {
  static method Main() {}
}
```

<!-- INSERT-TEXT -->

## **Error: This method 'Main' is not permitted as a main method (_reason_).** {#c_Main_method_not_permitted}

<!-- %check-run -->
```dafny
method Main(i: int) {}
```

<!-- INSERT-TEXT -->

## **Error: Function _name_ has no body so it cannot be compiled** {#c_function_has_no_body}

<!-- %check-run -->
```dafny
function f(): int
```

<!-- INSERT-TEXT -->

## **Error: Function _name_ must be compiled to use the {:test} attribute** {#c_test_function_must_be_compilable}

<!-- %check-run -->
```dafny
ghost function {:test} f(): int { 42 }
```

<!-- INSERT-TEXT -->

## **Error: Method _name_ is annotated with :synthesize but is not static, has a body, or does not return anything** {#c_invalid_synthesize_method}

<!-- TODO: Need example? -->
<!-- INSERT-TEXT -->

## **Error: Method _name_ has no body so it cannot be compiled** {#c_method_has_no_body}

<!-- %check-run -->
```dafny
method m()
```

<!-- INSERT-TEXT -->

## **Warning: assume statement has no {:axiom} annotation** {#r_assume_statement_without_axiom}

<!-- %check-run -->
```dafny
method m(x: int) {
  assume x > 0;
}
```

<!-- INSERT-TEXT -->

## **Error: a forall statement without a body cannot be compiled** {#c_forall_statement_has_no_body}

<!-- %no-check  FIX: now has multiple lines of error messages -->
```dafny
predicate P(i: int)
method m(a: array<int>) {
  forall x: int | P(x) 
  var y := 3;
}
```

<!-- INSERT-TEXT -->

## **Error: a loop without a body cannot be compiled** {#c_loop_has_no_body}

<!-- %no-check  FIX: now has multiple lines of error messages -->
```dafny
ghost method m(i: int) {
  var x: int := i;
  while x > 0 
  x := 3;
}
```

<!-- INSERT-TEXT -->

## **Error: nondeterministic assignment forbidden by the --enforce-determinism option** {#c_nondeterminism_forbidden}

<!-- %check-resolve %options --enforce-determinism -->
```dafny
method m() {
  var x: int;
  x := *;
}
```

<!-- INSERT-TEXT -->

<!-- TODO - test all 3 instances -->

## **Error: assign-such-that statement forbidden by the --enforce-determinism option** {#c_assign_such_that_forbidden}

<!-- %check-resolve %options --enforce-determinism -->
```dafny
method m() {
  var x: int;
  x :| x < 5;
}
```

<!-- INSERT-TEXT -->

## **Error: this assign-such-that statement is too advanced for the current compiler; Dafny's heuristics cannot find any bound for variable '_name_'** {#c_assign_such_that_is_too_complex}

<!-- TODO - needs example -->
<!-- INSERT-TEXT -->

## **Error: nondeterministic if statement forbidden by the --enforce-determinism option** {#c_nondeterministic_if_forbidden}

<!-- %check-resolve %options --enforce-determinism -->
```dafny
method m() {
var y: int;
  if * { y:= 0; } else { y:= 1; }
}
```

<!-- INSERT-TEXT -->

## **Error: binding if statement forbidden by the --enforce-determinism option** {#c_binding_if_forbidden}

<!-- TODO: a binding guard is a ghost statement so how could this situation ever happen? -->

<!-- %no-check %options --enforce-determinism -->
```dafny
method m(k: int) {
  var i := k;
  var y: int;
  if i :| i < 5 {  } else { y := 1; }
}
```

<!-- INSERT-TEXT -->

## **Error: case-based if statement forbidden by the --enforce-determinism option** {#c_case_based_if_forbidden}

<!-- %check-resolve %options --enforce-determinism -->
```dafny
method m(k: int) {
  var i := k;
  if
  {
    case i >= 0 => i := i - 1;
    case i <= 0 => i := i + 1;
  }
}
```

<!-- INSERT-TEXT -->

## **Error: nondeterministic loop forbidden by the --enforce-determinism option** {#c_non_deterministic_loop_forbidden}

<!-- %check-resolve %options --enforce-determinism -->
```dafny
method m(b: bool) decreases * {
  while * 
    decreases *
  { }
}
```

<!-- INSERT-TEXT -->

## **Error: case-based loop forbidden by the --enforce-determinism option** {#c_case_based_loop_forbidden}

<!-- %check-resolve %options --enforce-determinism -->
```dafny
method m(k: int) {
  var i := k;
  while 
    decreases if i < 0 then -i else i
  {
    case i > 0 => i := i - 1;
    case i < 0 => i := i + 1;
  }
}
```

<!-- INSERT-TEXT -->

## **Error: compiler currently does not support assignments to more-than-6-dimensional arrays in forall statements** {#c_no_assignments_to_seven_d_arrays}

<!-- TODO -- needs example and explanation -->
<!-- INSERT-TEXT -->

## **Error: modify statement without a body forbidden by the --enforce-determinism option** {#c_bodyless_modify_statement_forbidden}

<!-- %check-resolve %options --enforce-determinism -->
```dafny
class A { constructor A(){}}

method m(k: int, o: A) 
  modifies o
{
  var i := k;
  modify o;
}
```

<!-- INSERT-TEXT -->

## **Error: this let-such-that expression is too advanced for the current compiler; Dafny's heuristics cannot find any bound for variable '_name_'** {#c_let_such_that_is_too_complex}

<!-- TODO: needs example and explanataion -->
<!-- INSERT-TEXT -->

<!-- DafnyCore/Compilers/CSharp/Synthesizer-Csharp.cs -->

## **Error: Post-conditions on function _function_ might be unsatisfied when synthesizing code for method _name_" {#c_possibly_unsatisfied_postconditions}

<!-- TODO: Example? Say more? Better documentation? -->
<!-- INSERT-TEXT -->

## **Error: Stubbing fields is not recommended (field _name_ of object _object_ inside method _method_)** {#c_stubbing_fields_not_recommended}

<!-- TODO: Example? Say more? Better documentation? -->
<!-- INSERT-TEXT -->

<!-- DafnyCore/Compilers/Cplusplus/Compiler-Cpp.cs -->

 
## **Error: Abstract type ('_type_') with unrecognized extern attribute _attr_ cannot be compiled.  Expected {:extern compile_type_hint}, e.g., 'struct'.** {#c_abstract_type_cannot_be_compiled_extern}

<!-- %check-run %options --enforce-determinism --target cpp --unicode-char:false -->
```dafny
type {:extern "class" } T
```

<!-- INSERT-TEXT -->

<!-- DafnyCore/Compilers/Compiler-go.cs -->
# Errors specific to the Go compiler

## **Error: Unsupported field _name_ in extern trait** {#c_Go_unsupported_field}

<!-- TODO: needs example and explanation -->
<!-- INSERT-TEXT -->

## **Error: Cannot convert from _type_ to _target-type_** {#c_Go_infeasible_conversion}

<!-- TODO - may not be feasible -->
<!-- INSERT-TEXT -->
