diff --git a/lsp/src/completion/builtin.rs b/lsp/src/completion/builtin.rs index 86f4acce..a18e9ee0 100644 --- a/lsp/src/completion/builtin.rs +++ b/lsp/src/completion/builtin.rs @@ -43,7 +43,7 @@ pub fn match_callname(call: &CallName) -> Option { Some(FunctionTemplate::new( "unwrap_left", vec![format!("{ty}")], - vec![format!("Either<{ty}, U>")], + vec![format!("Either")], ty, doc, )) @@ -53,7 +53,7 @@ pub fn match_callname(call: &CallName) -> Option { Some(FunctionTemplate::new( "unwrap_right", vec![format!("{ty}")], - vec![format!("Either")], + vec![format!("Either<{ty}, U>")], ty, doc, )) @@ -136,15 +136,17 @@ fn builtin_documentation(call: &CallName) -> String { "Extracts the left variant of an `Either` value.\n Returns the left-side value if it exists, otherwise panics.\n ```simplicityhl -let x: Either = Left(42); -let y: u8 = unwrap_left::(x); // 42 +let x: Either = Left(42); +// We must specify the type of the right variant so the compiler knows the full type. +let y: u8 = unwrap_left::(x); // 42 ```", CallName::UnwrapRight(_) => "Extracts the right variant of an `Either` value.\n Returns the right-side value if it exists, otherwise panics.\n ```simplicityhl -let x: Either = Right(128); -let y: u8 = unwrap_right::(x); // 128 +let x: Either = Right(128); +// We must specify the type of the left variant so the compiler knows the full type. +let y: u32 = unwrap_right::(x); // 128 ```", CallName::Unwrap => "Unwraps an `Option` value, panicking if it is `None`.\n