mlabs-haskell / lambda-buffers

LambdaBuffers toolkit for sharing types and their semantics between different languages
https://mlabs-haskell.github.io/lambda-buffers/
Apache License 2.0
29 stars 0 forks source link

Aligns error reporting with the GNU standard #147

Closed bladyjoker closed 10 months ago

bladyjoker commented 10 months ago

Closes #144

Tried my best to align it but there's still awkwardness in the output. I don't know how GNU standard https://www.gnu.org/prep/standards/html_node/Errors.html accounts for message types (info/err/debug etc). I would like to have smtn like Syslog tbh, but whatever IDEs want I'm fine with that.

Maybe I should just split to stdout for INFO and stderr for ERROR, I always disliked having 2 separate files for this especially when I'm trying to pipe and then completely forget how to process the stderr.

Example

duplicate_tydef/A.lbf:5.1-5.12: [module A] Duplicate type definition with the name A [ERROR]                                                                                                                                                                                                                                                                                          
import_cycle_found/C.lbf:3.1-3.9: [module C] Tried to load module A which constitutes a cycle [B, A, ] [ERROR]                                                                                                                                                                                                                                                                        
imported_not_found/A.lbf:3.17-3.18: [module A] Name C not found in module B, did you mean one of the types: A B. Or did you mean one of the classes:  [ERROR]                                                                                                                                                                                                                         
invalid_module_filepath/A.lbf:1.8-1.13: [module A.B.C] File name invalid_module_filepath/A.lbf doesn't match module name A.B.C expected A/B/C.lbf [ERROR]                                                                                                                                                                                                                             
module_not_found/A.lbf:3.1-3.9: [module A] Module B not found in available import paths [., module_not_found] [ERROR]                                                                                                                                                                                                                                                                 
module_parse_error/A.lbf:3.1:                                                                                                                                                                                                                                                                                                                                                         
unexpected 't'                                                                                                                                                                                                                                                                                                                                                                        
expecting import statement, type definition, class definition, instance clause, derive statement or end of input [ERROR]                                                                                                                                                                                                                                                              
multiple_modules_found/A.lbf:3.1-3.9: [module A] Module B found in multiple files [multiple_modules_found/B.lbf, multiple_modules_found/another_import_path/B.lbf] [ERROR]                                                                                                                                                                                                            
symbol_already_imported/A.lbf:4.1-4.9: [module A] Type name A already imported from module B [ERROR]                                                                                                                                                                                                                                                                                  
tydef_name_conflict/A.lbf:5.5-5.6: [module A] Type name A conflicts with an imported type name from module B [ERROR]                                                                                                                                                                                                                                                                  
tyref_not_found/A.lbf:6.13-6.28: [module A] Type WhereIsThisType not found in the module's scope A B C B.B C.C [ERROR]                                                                                                                                                                                                                                                                
Calling: /nix/store/jmzq37c7l89qnvhyk1a3s98dl9b8lwki-lambda-buffers-compiler-exe-lbc-0.1.0.0/bin/lbc compile --input-file /tmp/lbf-c229555e491ac5fc/compiler-input.textproto --output-file /tmp/lbf-c229555e491ac5fc/compiler-output.textproto [INFO]                                                                                                                                 
/nix/store/jmzq37c7l89qnvhyk1a3s98dl9b8lwki-lambda-buffers-compiler-exe-lbc-0.1.0.0/bin/lbc: Reading Compiler Input from /tmp/lbf-c229555e491ac5fc/compiler-input.textproto [INFO] [INFO]                                                                                                                                                                                             
/nix/store/jmzq37c7l89qnvhyk1a3s98dl9b8lwki-lambda-buffers-compiler-exe-lbc-0.1.0.0/bin/lbc: /tmp/lbf-c229555e491ac5fc/compiler-input.textproto: Compilation succeeded [INFO] [INFO]                                                                                                                                                                                                  
/nix/store/jmzq37c7l89qnvhyk1a3s98dl9b8lwki-lambda-buffers-compiler-exe-lbc-0.1.0.0/bin/lbc: Writing Compiler Output at /tmp/lbf-c229555e491ac5fc/compiler-output.textproto [INFO] [INFO]                                                                                                                                                                                             
Success from: /nix/store/jmzq37c7l89qnvhyk1a3s98dl9b8lwki-lambda-buffers-compiler-exe-lbc-0.1.0.0/bin/lbc compile --input-file /tmp/lbf-c229555e491ac5fc/compiler-input.textproto --output-file /tmp/lbf-c229555e491ac5fc/compiler-output.textproto [INFO]                                                                                                                            
Compilation OK [INFO]                                                                                                                                                                                                                                                                                                                                                                 
Calling: /nix/store/ddfl89wfbkpvzrkmnnwyxl6vyn4skjrp-lbg-haskell/bin/lbg-haskell --input /tmp/lbf-c229555e491ac5fc/codegen-input.textproto --output /tmp/lbf-c229555e491ac5fc/codegen-output.textproto --gen-dir good/autogen --debug Test [INFO]                                                                                                                                     
/nix/store/ddfl89wfbkpvzrkmnnwyxl6vyn4skjrp-lbg-haskell/bin/lbg-haskell: Reading Codegen Input at /tmp/lbf-c229555e491ac5fc/codegen-input.textproto [INFO] [INFO]                                                                                                                                                                                                                     
/nix/store/ddfl89wfbkpvzrkmnnwyxl6vyn4skjrp-lbg-haskell/bin/lbg-haskell: Options received: GenOpts {_inputFile = "/tmp/lbf-c229555e491ac5fc/codegen-input.textproto", _outputFile = "/tmp/lbf-c229555e491ac5fc/codegen-output.textproto", _genDir = "good/autogen", _debug = True, _requestedClasses = [], _requestedModules = "Test" :| []} [INFO] [INFO]                            
/nix/store/ddfl89wfbkpvzrkmnnwyxl6vyn4skjrp-lbg-haskell/bin/lbg-haskell: Computed class closure:  [INFO] [INFO]                                                                                                                                                                                                                                                                       
/nix/store/ddfl89wfbkpvzrkmnnwyxl6vyn4skjrp-lbg-haskell/bin/lbg-haskell: /tmp/lbf-c229555e491ac5fc/codegen-input.textproto: Code generation failed for module Test [INFO] [INFO]                                                                                                                                                                                                      
/nix/store/ddfl89wfbkpvzrkmnnwyxl6vyn4skjrp-lbg-haskell/bin/lbg-haskell: /tmp/lbf-c229555e491ac5fc/codegen-input.textproto: Code generation failed [ERROR] [INFO]                                                                                                                                                                                                                     
/nix/store/ddfl89wfbkpvzrkmnnwyxl6vyn4skjrp-lbg-haskell/bin/lbg-haskell: Writing Codegen Output at /tmp/lbf-c229555e491ac5fc/codegen-output.textproto [INFO] [INFO]                                                                                                                                                                                                                   
Success from: /nix/store/ddfl89wfbkpvzrkmnnwyxl6vyn4skjrp-lbg-haskell/bin/lbg-haskell --input /tmp/lbf-c229555e491ac5fc/codegen-input.textproto --output /tmp/lbf-c229555e491ac5fc/codegen-output.textproto --gen-dir good/autogen --debug Test [INFO]                                                                                                                                
/nix/store/ddfl89wfbkpvzrkmnnwyxl6vyn4skjrp-lbg-haskell/bin/lbg-haskell:The requested Codegen backend doesn't support the LambdaBuffers `opaque` type 'Bytes' defined in module 'Test' [ERROR]                                                                                                                                                                                        
t4ccer commented 10 months ago

Looks fine, format parses correctly Screenshot_20231116_123413

t4ccer commented 10 months ago

Usually the split between stdout and stderr is such that to stdout goes stuff that you may want to pipe into another tool and all diagnostics into stderr. E.g. with curl all progress and debug stuff from -v goes to stderr but the file you're downloading goes to stdout. Not sure if there is a meaningful stdout for LB though

bladyjoker commented 10 months ago

@t4ccer how do you use this output with Emacs? I assume you get something out of the box with some kind of mode?

t4ccer commented 10 months ago

Plain emacs M-x compile <type your command>