@@ -1541,7 +1541,7 @@ fn builtin_signatures() -> Vec<FunctionSig> {
15411541 "Image" ,
15421542 "load" ,
15431543 & [ param( "path" , ParamEffect :: Read , "Path" ) ] ,
1544- Some ( "Image" ) ,
1544+ Some ( "Result< Image, ImageError> " ) ,
15451545 true ,
15461546 & [ ] ,
15471547 ) ,
@@ -1580,7 +1580,7 @@ fn builtin_signatures() -> Vec<FunctionSig> {
15801580 param( "image" , ParamEffect :: Read , "Image" ) ,
15811581 param( "path" , ParamEffect :: Read , "Path" ) ,
15821582 ] ,
1583- Some ( "Unit" ) ,
1583+ Some ( "Result< Unit, ImageError> " ) ,
15841584 false ,
15851585 & [ ] ,
15861586 ) ,
@@ -1631,7 +1631,7 @@ fn builtin_signatures() -> Vec<FunctionSig> {
16311631 "File" ,
16321632 "read_all" ,
16331633 & [ param( "file" , ParamEffect :: Mut , "File" ) ] ,
1634- Some ( "Bytes" ) ,
1634+ Some ( "Result< Bytes, FileError> " ) ,
16351635 true ,
16361636 & [ ] ,
16371637 ) ,
@@ -1642,7 +1642,7 @@ fn builtin_signatures() -> Vec<FunctionSig> {
16421642 param( "file" , ParamEffect :: Mut , "File" ) ,
16431643 param( "data" , ParamEffect :: Read , "Bytes" ) ,
16441644 ] ,
1645- Some ( "Unit" ) ,
1645+ Some ( "Result< Unit, FileError> " ) ,
16461646 false ,
16471647 & [ ] ,
16481648 ) ,
@@ -1697,7 +1697,7 @@ fn builtin_signatures() -> Vec<FunctionSig> {
16971697 "Json" ,
16981698 "parse" ,
16991699 & [ param( "text" , ParamEffect :: Read , "String" ) ] ,
1700- Some ( "JsonValue" ) ,
1700+ Some ( "Result< JsonValue, JsonError> " ) ,
17011701 true ,
17021702 & [ ] ,
17031703 ) ,
@@ -1708,8 +1708,8 @@ fn builtin_signatures() -> Vec<FunctionSig> {
17081708 param( "value" , ParamEffect :: Read , "JsonValue" ) ,
17091709 param( "name" , ParamEffect :: Read , "String" ) ,
17101710 ] ,
1711- Some ( "String" ) ,
1712- true ,
1711+ Some ( "Result< String, JsonError> " ) ,
1712+ false ,
17131713 & [ ] ,
17141714 ) ,
17151715 builtin(
@@ -1719,15 +1719,15 @@ fn builtin_signatures() -> Vec<FunctionSig> {
17191719 param( "file" , ParamEffect :: Mut , "File" ) ,
17201720 param( "buffer" , ParamEffect :: Mut , "RowBuffer" ) ,
17211721 ] ,
1722- Some ( "Unit" ) ,
1722+ Some ( "Result< Unit, CsvError> " ) ,
17231723 false ,
17241724 & [ ] ,
17251725 ) ,
17261726 builtin(
17271727 "Csv" ,
17281728 "parse_row" ,
17291729 & [ param( "buffer" , ParamEffect :: Read , "RowBuffer" ) ] ,
1730- Some ( "Row" ) ,
1730+ Some ( "Result< Row, CsvError> " ) ,
17311731 true ,
17321732 & [ ] ,
17331733 ) ,
@@ -1789,7 +1789,7 @@ fn builtin_signatures() -> Vec<FunctionSig> {
17891789 param( "conn" , ParamEffect :: Mut , "DbConnection" ) ,
17901790 param( "sql" , ParamEffect :: Read , "String" ) ,
17911791 ] ,
1792- None ,
1792+ Some ( "Result<Unit, DbError>" ) ,
17931793 false ,
17941794 & [ ] ,
17951795 ) ,
@@ -1805,7 +1805,7 @@ fn builtin_signatures() -> Vec<FunctionSig> {
18051805 "RuleLoader" ,
18061806 "load_rules" ,
18071807 & [ param( "path" , ParamEffect :: Read , "Path" ) ] ,
1808- Some ( "List" ) ,
1808+ Some ( "Result< List<Rule>, ConfigError> " ) ,
18091809 true ,
18101810 & [ ] ,
18111811 ) ,
@@ -1987,7 +1987,10 @@ fn cache_put(cache: mut Cache, value: read Image) -> Unit
19871987 let load = hir
19881988 . resolve_function ( Some ( "Image" ) , "load" )
19891989 . expect ( "builtin signature exists" ) ;
1990- assert_eq ! ( load. return_type. as_deref( ) , Some ( "Image" ) ) ;
1990+ assert_eq ! (
1991+ load. return_type. as_deref( ) ,
1992+ Some ( "Result<Image, ImageError>" )
1993+ ) ;
19911994 }
19921995
19931996 #[ test]
@@ -2011,8 +2014,8 @@ fn Image(path: read Path) -> Image {
20112014
20122015 assert_eq ! ( duplicate. kind, DuplicateSymbolKind :: Constructor ) ;
20132016 assert_eq ! ( duplicate. name, "Image" ) ;
2014- assert_eq ! ( duplicate. first_span. line, 4 ) ;
2015- assert_eq ! ( duplicate. duplicate_span. line, 8 ) ;
2017+ assert_eq ! ( duplicate. first_span. line, 3 ) ;
2018+ assert_eq ! ( duplicate. duplicate_span. line, 7 ) ;
20162019 }
20172020
20182021 #[ test]
@@ -2034,8 +2037,8 @@ struct Response {
20342037
20352038 assert_eq ! ( duplicate. kind, DuplicateSymbolKind :: Field ) ;
20362039 assert_eq ! ( duplicate. name, "Response.status" ) ;
2037- assert_eq ! ( duplicate. first_span. line, 5 ) ;
2038- assert_eq ! ( duplicate. duplicate_span. line, 6 ) ;
2040+ assert_eq ! ( duplicate. first_span. line, 4 ) ;
2041+ assert_eq ! ( duplicate. duplicate_span. line, 5 ) ;
20392042 }
20402043
20412044 #[ test]
@@ -2124,7 +2127,7 @@ fn render(body: read String) -> Result<fresh Response, HttpError> {
21242127features: local
21252128
21262129fn load(path: read Path) -> Unit {
2127- local image = Image.load(path: read path)
2130+ local image = Image.load(path: read path)?
21282131}
21292132"# ;
21302133
@@ -2309,7 +2312,7 @@ struct Config {
23092312}
23102313
23112314fn update(cache: mut ImageCache, config: mut Config, path: read Path) -> Unit {
2312- local image = Image.load(path: read path)
2315+ local image = Image.load(path: read path)?
23132316 ImageCache.store(cache: mut cache, image: read image)
23142317 List.consume(list: take config.rules)
23152318}
@@ -2324,7 +2327,7 @@ fn update(cache: mut ImageCache, config: mut Config, path: read Path) -> Unit {
23242327 let HirStmt :: Let {
23252328 kind : HirBindingKind :: LocalLet ,
23262329 name,
2327- value : Some ( HirExpr :: Call { type_name, .. } ) ,
2330+ value : Some ( HirExpr :: Try { type_name, .. } ) ,
23282331 type_name : Some ( binding_type) ,
23292332 ..
23302333 } = & block. statements [ 0 ]
0 commit comments