mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Optional Class (#2096)
Adding Optional class to prelude... I hope it is useful! Co-authored-by: m new <michael.burzan@outlook.de> Co-authored-by: Richard Smith <richard@metafoo.co.uk> Co-authored-by: Geoff Romer <gromer@google.com>
This commit is contained in:
co-authored by
m new
Richard Smith
Geoff Romer
parent
5456011980
commit
c096d010b9
@@ -0,0 +1,20 @@
|
||||
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{explorer} %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
|
||||
// RUN: %{explorer} --parser_debug --trace_file=- %s 2>&1 | \
|
||||
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
// CHECK: result: 0
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
fn Main() -> i32{
|
||||
var x: Optional(String) = Optional(String).CreateEmpty();
|
||||
if(x.HasValue()){
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user