* check that the return type is a type, add more implicit conversions
* update IsConcreteType for generic classes, add IsType predicate
* delete a comment
* trivial change
* move Witness wrt IsConcreteType and IsType
* added comments to tests
* update error line numbers
This is a workaround for #1208, allowing to remove manual tag to allow building and testing fuzzer code during precommits and in bazel test ...
Tested:
bazel test -k ...
bazel build -c opt executable_semantics/fuzzing:executable_semantics_fuzzer
bazel-bin/executable_semantics/fuzzing/executable_semantics_fuzzer
I went down this route because I figured the installer binary should be in `check_deps`. The result:
- Add thin wrapper scripts for `buildozer` and `bazel`, similar to the `buildifier` wrapper that's already there.
- These are mainly to avoid deduplicating logic, and dodging intricacies of Python imports that I don't understand well through instead subprocessing.
- Fix update_roots.py (it was missing a `.parent`, must've been relocated without a re-run at some point)
- Fix fuzzer proto code to be `testonly`
- Update the `check_deps` targets
Breaks `--trace` into two flags:
- `--parser_debug`, which sets the parser debug level (which I haven't dug into piping with `--trace`, but seemed likely to be troublesome)
- `--trace_file`, which now the type checker and interpreter will use for trace information (note compile errors should use a different channel)
Most of the file edits are just mechanical testdata flag updates: `sed -i 's/--trace/--parser_debug --trace_file=-/' testdata/**/*.carbon`
To explain the output paths:
- parse/compile errors: stderr
- print() calls: stdout
- parser tracing: `--parser_debug` option, stdout (formerly stdout if `--trace`)
- type check/compile tracing: `--trace_file=<file>`, giving `-` uses stdout (formerly stdout if `--trace`)
- return code of executed Carbon code: `--trace_file` if set, stdout if not (formerly stdout always)
I think this will work on linux/mac, not windows obviously. But the essence is that running `bazel run -c opt //installers/local:install` will create:
Symlink: /usr/bin/carbon-explorer -> /usr/lib/carbon/carbon
BusyBox-style binary: /usr/lib/carbon/carbon
File: /usr/lib/carbon/data/prelude.carbon
And then just running `carbon-explorer foo.carbon` with no flags (in particular, not --prelude) will work.
Since this removes the need for prelude_file in most cases, I'm removing the relative path logic added in #1179 -- it would otherwise conflict with what I'm doing here. I *think* overall this will result in something even simpler and more reliable for compiler explorer to use, and hopefully with enough flexibility that it's easy for us to change how it's implemented later without breaking much.
This allows it to find the prelude when run out of a Bazel runfiles tree
regardless of the current working directory. For example, this will
allow local testing of compiler explorer.
* finished fuzzer and added fuzzverter util
* fixed typo
* renamed cmd line params
* fixed libproto_mutator download path
* small fixes
* small fixes
* small fixes
* renamed sample corpus proto
* small fixes
* try building on github with LIBCPP_DEBUG enabled
* temporarily marked proto fuzzer as a manual test
* code review
* use a dedicated proto-fuzzer feature to work around LIBCPP_DEBUG=1 crash in proto code
* code review comments, added README.md
* minor fixes to the text
* Update bazel/cc_toolchains/clang_cc_toolchain_config.bzl
Co-authored-by: Jon Meow <jperkins@google.com>
* use Carbon source representation for "empty Main()" instead of text format proto representation
* fixed typo
* made FuzzerUtil produce the full carbon source (proto converted + Main if needed) to decrease code duplication a bit
* typo
* switched to text proto format per code review
* Update executable_semantics/prelude.h
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/fuzzing/README.md
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/fuzzing/README.md
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/fuzzing/README.md
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/fuzzing/README.md
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/fuzzing/README.md
Co-authored-by: Jon Meow <jperkins@google.com>
* review comments
* removed unnecessary file mode variables
* Update executable_semantics/fuzzing/fuzzverter.cpp
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/fuzzing/README.md
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/fuzzing/README.md
Co-authored-by: Jon Meow <jperkins@google.com>
* code review comments
* Update executable_semantics/syntax/BUILD
Co-authored-by: Jon Meow <jperkins@google.com>
* buildifier
Co-authored-by: Jon Meow <jperkins@google.com>
* Carbon fuzzing 2/3: added logic for converting carbon.proto to a Carbon source string.
* adjusted to proto changes in proto PR
* addressed todos
* removed unnecessary has_xx() calls
* minor fix
* sync from part 1
* Update executable_semantics/fuzzing/proto_to_carbon_test.cpp
Co-authored-by: Geoff Romer <gromer@google.com>
* review comments
* Update common/fuzzing/proto_to_carbon.cpp
Co-authored-by: Jon Meow <jperkins@google.com>
* Update common/fuzzing/proto_to_carbon.cpp
Co-authored-by: Jon Meow <jperkins@google.com>
* code review
* code review
* Update common/fuzzing/proto_to_carbon.cpp
Co-authored-by: Jon Meow <jperkins@google.com>
* code review
* merged + added support for type_params in class
* use <> includes for protobuf
* review comments
* code review comments
Co-authored-by: Geoff Romer <gromer@google.com>
Co-authored-by: Jon Meow <jperkins@google.com>
* start of generic classes
* fix regressions
* class functions in interfaces
* access to class function on interface from class parameter
* more stuff working for generic classes
* fixing bugs
* update TypeEqual for generic classes
* fixing bugs and finding new ones
* disable unqualified access to members from other members for now
* minor edits
* bug fixes
* introduce compile_time_value to use in type checker instead of constant_value
* cleanup
* put a CHECK back in
* failure test cases for the new FATAL_COMPILATION_ERROR
* change a runtime FATAL into a FATAL_COMPILATION_ERROR
* Update executable_semantics/ast/declaration.h
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/interpreter/action_stack.cpp
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/interpreter/interpreter.cpp
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/interpreter/value.cpp
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/interpreter/value.cpp
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/interpreter/interpreter.cpp
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/interpreter/value.cpp
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/interpreter/value.cpp
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/interpreter/resolve_names.cpp
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/interpreter/type_checker.cpp
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/interpreter/type_checker.cpp
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/interpreter/type_checker.cpp
Co-authored-by: Jon Meow <jperkins@google.com>
* responses to reviews
* Update executable_semantics/interpreter/type_checker.cpp
Co-authored-by: Jon Meow <jperkins@google.com>
* rename compile_time_value to symbolic_identity
* Update executable_semantics/interpreter/type_checker.cpp
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/interpreter/type_checker.cpp
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/interpreter/type_checker.cpp
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/interpreter/type_checker.cpp
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/interpreter/type_checker.cpp
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/interpreter/type_checker.cpp
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/interpreter/value.cpp
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/interpreter/value.cpp
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/interpreter/value.cpp
Co-authored-by: Jon Meow <jperkins@google.com>
* more edits from review
* Apply suggestions from code review
Co-authored-by: Geoff Romer <gromer@google.com>
* review responses
* Update executable_semantics/interpreter/interpreter.cpp
Co-authored-by: Geoff Romer <gromer@google.com>
* const impl_scope for TypeCheckChoiceDeclaration
* add some const
Co-authored-by: Jon Meow <jperkins@google.com>
Co-authored-by: Geoff Romer <gromer@google.com>
* initial fuzzer proto
* visibility change
* use newer protocol buffer version which has the defs.bzl bug fixed
* Adjusted fix_cc_deps to work with protobuf external repo
* explicitly load rules_cc to avoid a frozenset bug in the version loaded by protobuf
* use explit deps, use llvm's zlib
* restored cxx settings
* deps change
* Cleaned up WORKSPACE and changed the test to read carbon sources from testdata
* updated comment
* adapted to new ErrorOr return value
* proto buffer 3.19.2 -> 3.19.4
* changed comment
* Apply suggestions from code review
Co-authored-by: Jon Meow <jperkins@google.com>
* Apply suggestions from code review
Co-authored-by: Jon Meow <jperkins@google.com>
* Update executable_semantics/fuzzing/BUILD
Co-authored-by: Jon Meow <jperkins@google.com>
* addressed review comments
* updated Unimplemented error message
* Addressed review comments
* more review comments
* switched to loading protobuf via rules_proto()
* Ignore protobuf headers in fix_cc_deps.py until the script supports alias rules
* renamed repeated proto fields to be plural
* added @zlib to check_non_test_cc_deps
* Update common/fuzzing/BUILD
Co-authored-by: Jon Meow <jperkins@google.com>
* review comments
* set is_omitted_expression for return value
Co-authored-by: Jon Meow <jperkins@google.com>
* Modify parser and AST nodes to include let statement
* Implement let variables
* Remove redundant code in fail_match_choice test
* Add comment for has_value_category()
* Apply suggestions from code review
Co-authored-by: Jon Meow <46229924+jonmeow@users.noreply.github.com>
* clang-format changes
* Update comments for new BindingPattern methods
* Implement nested vars in patterns
* Apply suggestions from @geoffromer's code review
Co-authored-by: Geoff Romer <gromer@google.com>
* Implement changes from code review.
* Remove maybe_var_pattern grammar rule
Co-authored-by: Jon Meow <46229924+jonmeow@users.noreply.github.com>
Co-authored-by: Geoff Romer <gromer@google.com>
* Fixed a couple simple crashes surfaced by running a structured fuzzer on executable_semantics parse/type-check/execute logic.
* var a: b: auto; -> var a: auto;
In the process, switch to an unambiguous grammar, using the
precedence-climbing method for operator precedence (suitably modified to
handle a partial precedence order) rather than Bison %precedence /
%prec.
Line 91 has:
```
source_loc_(type_expression->source_loc()) {}
```
Which requires the Expression definition. This probably compiles accidentally due to #include ordering, but I ran into a case that needs correct #includes.
This switches to generating per-file targets such as `//executable_semantics/testdata:tuple/equality_false.carbon.test`, instead of one test covering all files. Essentially this relies on bazel instead of lit to handle test parallelization.
* adding methods to the ast
* pre commit stuff?
* implementation of class functions
* implemented methods
* some cleanup
* more cleanup
* add newlines in test programs
* pre-commit fixups
* added include of return_term.h
* a test of a method calling another method
* replacing Member with Declaration
* removing the member.h etc files
* clarify a type annotation
* update uses of FunctionDeclaration
* remove ReturnTarget, no longer needed
* more cleanup
* more cleanup
* yet more cleanup, playing with pre-commit
* did a pre-commit run --all-files
* fixed const issue
* remove comment
* checking dependencies in BUILD files and headers
* pre-commit working now
* refactor NominalClassType to just hold a pointer to the class declaration
* remove Member from rtti
* responding to Geoffreys review
* change field_types to a non-member function
* Naive pointer implementation
* Bug fixes and better pointer tests
* Remove debug print statement
* Implement changes suggested by @geoffromer
Also add a failing test case that tests applying the address-of operator
to an rvalue.
I think lit_test accrued a bit of cruft as I switched approaches... I still may go further, but this is particularly fixing a bug where `FileCheck` (instead of `%{FileCheck}`) should've failed in tests.