@@ -55,18 +55,7 @@ impl<'a, 'b, 'c> PipeTyper<'a, 'b, 'c> {
5555 let end = expressions. last ( ) . location ( ) . end ;
5656 let mut expressions = expressions. into_iter ( ) ;
5757 let first = expressions. next ( ) . expect ( "Empty pipeline in typer" ) ;
58- let first_location = first. location ( ) ;
59- let first = match expr_typer. infer_or_error ( first) {
60- Ok ( inferred) => inferred,
61- Err ( e) => {
62- expr_typer. problems . error ( e) ;
63- TypedExpr :: Invalid {
64- location : first_location,
65- type_ : expr_typer. new_unbound_var ( ) ,
66- extra_information : None ,
67- }
68- }
69- } ;
58+ let first = expr_typer. infer ( first) ;
7059
7160 Self :: new ( expr_typer, size, first, end) . infer_expressions ( expressions)
7261 }
@@ -140,20 +129,7 @@ impl<'a, 'b, 'c> PipeTyper<'a, 'b, 'c> {
140129 location,
141130 ..
142131 } => {
143- let fun = match self . expr_typer . infer_or_error ( * fun) {
144- Ok ( fun) => fun,
145- Err ( e) => {
146- // In case we cannot infer the function we'll
147- // replace it with an invalid expression with an
148- // unbound type to keep going!
149- self . expr_typer . problems . error ( e) ;
150- TypedExpr :: Invalid {
151- location,
152- type_ : self . expr_typer . new_unbound_var ( ) ,
153- extra_information : None ,
154- }
155- }
156- } ;
132+ let fun = self . expr_typer . infer ( * fun) ;
157133
158134 match fun. type_ ( ) . fn_types ( ) {
159135 // Rewrite as right(..args)(left)
@@ -352,19 +328,7 @@ impl<'a, 'b, 'c> PipeTyper<'a, 'b, 'c> {
352328 /// b is the `function` argument.
353329 fn infer_apply_pipe ( & mut self , function : UntypedExpr ) -> TypedExpr {
354330 let function_location = function. location ( ) ;
355- let function = Box :: new ( match self . expr_typer . infer_or_error ( function) {
356- Ok ( function) => function,
357- Err ( error) => {
358- // If we cannot infer the function we put an invalid expression
359- // in its place so we can still keep going with the other steps.
360- self . expr_typer . problems . error ( error) ;
361- TypedExpr :: Invalid {
362- location : function_location,
363- type_ : self . expr_typer . new_unbound_var ( ) ,
364- extra_information : None ,
365- }
366- }
367- } ) ;
331+ let function = Box :: new ( self . expr_typer . infer ( function) ) ;
368332
369333 self . expr_typer . purity = self
370334 . expr_typer
0 commit comments