Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update E_ValueRestriction01.fs
  • Loading branch information
Happypig375 authored and psfinaki committed Dec 15, 2023
commit 7761d3d5d502a620297705488c5fc19202e28920
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

// Verify error associated with open type variable

//<Expects id="FS0030" status="error">Value restriction: The value 'x' has an inferred generic type val x: '_a list refHowever, values cannot have generic type variables like '_a in "let x: '_a"\. You can do one of the following:- Define it as a simple data term like a string literal or a union case- Add an explicit type annotation- Use the value as a non-generic type in later code for type inference,or if you still want type-dependent results, you can define 'x' as a function instead by doing either:- Add a unit parameter- Write explicit type parameters like "let x<'a>"\.This error is because a let binding without parameters defines a value, not a function\. Values cannot be generic because reading a value is assumed to result in the same everywhere but generic type parameters may invalidate this assumption by enabling type-dependent results\.$</Expects>

//<Expects id="FS0030" status="error">Value restriction: The value 'x' has an inferred generic type\n val x: '_a list ref\nHowever, values cannot have generic type variables like '_a in "let x: '_a"\. You can do one of the following:\n- Define it as a simple data term like a string literal or a union case\n- Add an explicit type annotation\n- Use the value as a non-generic type in later code for type inference,\nor if you still want type-dependent results, you can define 'x' as a function instead by doing either:\n- Add a unit parameter\n- Write explicit type parameters like "let x<'a>"\.\nThis error is because a let binding without parameters defines a value, not a function\. Values cannot be generic because reading a value is assumed to result in the same everywhere but generic type parameters may invalidate this assumption by enabling type-dependent results\.$</Expects>
let x = ref []

exit 1