From 1313f5735a7c37ec34388e3d739c08091d2ffbb7 Mon Sep 17 00:00:00 2001 From: Josh L Date: Tue, 12 Jul 2022 15:44:19 +0000 Subject: [PATCH 01/20] Filling out template with PR 1382 --- proposals/p1382.md | 64 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 proposals/p1382.md diff --git a/proposals/p1382.md b/proposals/p1382.md new file mode 100644 index 0000000000000..4dfca39883f16 --- /dev/null +++ b/proposals/p1382.md @@ -0,0 +1,64 @@ +# Rename `me` -> `self` + + + +[Pull request](https://github.com/carbon-language/carbon-lang/pull/1382) + + + +## Table of contents + +- [Problem](#problem) +- [Background](#background) +- [Proposal](#proposal) +- [Details](#details) +- [Rationale](#rationale) +- [Alternatives considered](#alternatives-considered) + + + +## Problem + +TODO: What problem are you trying to solve? How important is that problem? Who +is impacted by it? + +## Background + +TODO: Is there any background that readers should consider to fully understand +this problem and your approach to solving it? + +## Proposal + +TODO: Briefly and at a high level, how do you propose to solve the problem? Why +will that in fact solve it? + +## Details + +TODO: Fully explain the details of the proposed solution. + +## Rationale + +TODO: How does this proposal effectively advance Carbon's goals? Rather than +re-stating the full motivation, this should connect that motivation back to +Carbon's stated goals and principles. This may evolve during review. Use links +to appropriate sections of [`/docs/project/goals.md`](/docs/project/goals.md), +and/or to documents in [`/docs/project/principles`](/docs/project/principles). +For example: + +- [Community and culture](/docs/project/goals.md#community-and-culture) +- [Language tools and ecosystem](/docs/project/goals.md#language-tools-and-ecosystem) +- [Performance-critical software](/docs/project/goals.md#performance-critical-software) +- [Software and language evolution](/docs/project/goals.md#software-and-language-evolution) +- [Code that is easy to read, understand, and write](/docs/project/goals.md#code-that-is-easy-to-read-understand-and-write) +- [Practical safety and testing mechanisms](/docs/project/goals.md#practical-safety-and-testing-mechanisms) +- [Fast and scalable development](/docs/project/goals.md#fast-and-scalable-development) +- [Modern OS platforms, hardware architectures, and environments](/docs/project/goals.md#modern-os-platforms-hardware-architectures-and-environments) +- [Interoperability with and migration from existing C++ code](/docs/project/goals.md#interoperability-with-and-migration-from-existing-c-code) + +## Alternatives considered + +TODO: What alternative solutions have you considered? From e4911fe60694b3a2f70b70d6f9b44914b89acd03 Mon Sep 17 00:00:00 2001 From: Josh L Date: Tue, 12 Jul 2022 16:37:47 +0000 Subject: [PATCH 02/20] Global search replace `me` -> `self` --- docs/design/README.md | 54 +- docs/design/classes.md | 72 +-- docs/design/expressions/README.md | 4 +- docs/design/expressions/arithmetic.md | 12 +- docs/design/expressions/as_expressions.md | 2 +- docs/design/expressions/bitwise.md | 12 +- .../expressions/comparison_operators.md | 58 +-- .../expressions/implicit_conversions.md | 2 +- docs/design/expressions/member_access.md | 44 +- docs/design/generics/appendix-coherence.md | 4 +- docs/design/generics/details.md | 466 +++++++++--------- docs/design/generics/overview.md | 36 +- docs/design/generics/terminology.md | 14 +- docs/design/templates.md | 4 +- explorer/ast/declaration.cpp | 20 +- explorer/ast/declaration.h | 10 +- explorer/ast/expression.h | 2 +- explorer/data/prelude.carbon | 18 +- explorer/fuzzing/ast_to_proto.cpp | 15 +- ... 01470906214372a9d64519f51bc84e89760838fc} | 18 +- ... 080504266a82cac1647fe47577ec3d03fc8f1e0b} | 24 +- ... 10262aa9c545ac25ae1cd7ccd0cdd7ad758ad1d8} | 8 +- ... 1b44103acf7ff5b98059b6ad83dfa87af4c820ca} | 18 +- ... 1dd799e27118a9b31c58732b5536bb969d5dec47} | 10 +- ... 1ed6b0aaabbdb804a00c5f9de15e87bcea7b2989} | 10 +- ... 1feb91d5bdcaaa895ac4bdc8144dae56a77af690} | 12 +- ... 21fb9b4ef5f3cb228ced87f428683058b6ec9d0f} | 12 +- ... 23acc22cb4275aa5e0e8709621fc88d7c780ea62} | 24 +- ... 2b19e350556fbbc1d4821da650b3cf0d17148ae9} | 6 +- ... 2df14ada752970f5920c267c33f0308ef50f0246} | 8 +- ... 304589d53b5ac70ae5b20bfb211e9ef2ef89c303} | 4 +- ... 38e8259579859a4b14e6589509b1c58c427e5e50} | 18 +- ... 399e83ac13c818d8ade85dda1d4918aa459186c9} | 6 +- ... 3bc84abaa7693f3ca0f0681f6f1097e1766d9d89} | 6 +- ... 3eb39ab6dba8cea78c2daebaf486a6be626ae7a6} | 6 +- ... 3ed8ca560ef34c454714552d051ec8d184dda8c3} | 4 +- ... 4511704cda32c21450acb1f1442ecc9f1979e9a5} | 10 +- ... 5a5456f6259ac15d8358430389aea12f145a44f7} | 24 +- ... 5b0eabed769a089e9906772fe0dfc78b111fee38} | 4 +- ... 5bd03bcc54eb9664e91595ce320d14f133233e73} | 24 +- ... 5c1540feb494c79e5f20e6f87651be05325cac4b} | 8 +- ... 6318884693dd31430b4b46b1305dae63f281751e} | 6 +- ... 64618fd348511e00ac19df9a99ac61329f13235a} | 6 +- ... 6767a2eb95f450545192b2ad69022bcbfe0ec98d} | 16 +- ... 68a5800e6a2dbe2f732129fe874f20bbb42b90b5} | 8 +- ... 69085645b1858d4812fa018eb8c1addb630253d1} | 40 +- ... 6a7199401d7f3938c79c0e967ebea78837a94a95} | 24 +- ... 6a879cdde713ac9009864ed5f9912616d314e017} | 6 +- ... 6b2bafceac3d58159bd93269556e1db2ea9c1470} | 10 +- ... 6c25c16bd50745570b78bee439871f5d6a0ca621} | 6 +- ... 781ecc36990e2394a0c6823855c583aae691bc78} | 6 +- ... 7da9f665980aa154e3e04524ab6284d08ede8f80} | 10 +- ... 7eabea18523cea963d3c7b0150afb7101805e32f} | 12 +- ... 8188e039b6d4d48035b5f86993575212c01d248a} | 24 +- ... 82280e14d4c28c51272136e746d7f54c25095951} | 20 +- ... 826fa4abee30374c115463db29d4a94c4ca3c98f} | 6 +- ... 864211adf7c5880a4c7862aed73b7ac0ac32b8a9} | 24 +- ... 8e41e48db8e0f14feea263e6c49c835b1b2ce53f} | 8 +- ... 97d6542094ef4b6e4322cddf33f59440c5b6ea61} | 24 +- ... 981655702b85acf10978cdb81df86b9399788092} | 4 +- ... 9c9fc5cca447d05d54f0200271e4cc6d228fe056} | 16 +- ... 9e4121f79f2fee85e9964bebf21543de57c1d439} | 24 +- ... a394d42f77cdc9659ff63881715f4852eea0a3af} | 18 +- ... a5808cf255331e29840cb6878f8a4732c4bd6a08} | 52 +- ... a63c576d4b2e1a63c3f9b960c861f9ba7513bb67} | 8 +- ... a71bb2c74fc34cb14adf428db9dd48e6ada14bb6} | 24 +- ... b1f2cfe33f8d50f38ce8addd62b76519bd589d9e} | 4 +- ... b32e22f8b9b251438cf5d689f5f077daaa3f3bdf} | 8 +- ... b8c12a825a41b0b25af0f44a119d6993f90af611} | 10 +- ... b8e05ecd5da75a6af34295d2396d27fec1cfd4d5} | 6 +- ... be2a3f66b52634d15b9e34c0ed93ce8ffebcd527} | 6 +- ... c0f26047718df883b42cab5fd891a7a58663d5fd} | 26 +- ... c2646dc4add2384ca4c733a9a706b218397cc1c8} | 6 +- ... c7d4d21e67b7c6a1f952e22f81fcb158a53e208d} | 10 +- ... cd31cdffa19ef031d14c0d3440a7d14f2433b923} | 24 +- ... ce85fb106849dde89ccc11e6ff799faa8c74af07} | 6 +- ... ce8a72d8214224c0cf6cd1208452aa86ddb41a3c} | 6 +- ... d1e5a00347368e94959ff07b93e4c6a0762091a8} | 4 +- ... d438d10996b2ac3415accec527ba50adeda7a500} | 16 +- ... d4b10085400853e130d2f552d6493df76d33e24a} | 8 +- ... e18e54955a7d12d8676a628f6a8a2a700d09394d} | 4 +- ... e3b3b1f52b6d35189726bae3b49d358f1eda35d6} | 4 +- ... e6c980db2dc247d290d0bef72b045ddb3bc9e712} | 14 +- ... eebcd02d851ed64b1185b3eaa0b4d23f49189e06} | 24 +- ... eeffdec7cdffe7258413447330e745427673be5b} | 4 +- ... ef9e4ddee87e9a1551d2cf0f56c2b2698d6000c0} | 6 +- ... f2dfd518c2577c93096166bb98f1155256906d0b} | 16 +- ... f3efad50612502cd8b950bcac04915a6955c69bb} | 40 +- ... f7e287c201224da259cfdf413438115348e5f54a} | 14 +- ... f7f6d87bd21a9da0681c8728d40a6fd62dcd9ea7} | 10 +- ... fcbce51b08fb96910190bccab95620d12d64e5e2} | 4 +- explorer/interpreter/impl_scope.h | 4 +- explorer/interpreter/interpreter.cpp | 4 +- explorer/interpreter/resolve_names.cpp | 2 +- explorer/interpreter/type_checker.cpp | 13 +- explorer/interpreter/value.h | 2 +- explorer/testdata/addr/fail-method-let.carbon | 6 +- ...pe.carbon => fail-method-self-type.carbon} | 8 +- explorer/testdata/addr/method.carbon | 6 +- explorer/testdata/addr/nested-method.carbon | 6 +- explorer/testdata/alias/class_alias.carbon | 6 +- .../testdata/alias/member_name_alias.carbon | 8 +- explorer/testdata/assign/convert_rhs.carbon | 2 +- explorer/testdata/class/bound_method.carbon | 4 +- explorer/testdata/class/empty_class.carbon | 2 +- .../testdata/class/fail_method_deduced.carbon | 2 +- .../class/fail_method_from_class.carbon | 4 +- .../testdata/class/fail_method_in_var.carbon | 2 +- .../testdata/class/fail_return_method.carbon | 2 +- explorer/testdata/class/method.carbon | 4 +- .../testdata/class/method_call_method.carbon | 8 +- explorer/testdata/class/method_self.carbon | 4 +- .../testdata/constraint/binding_self.carbon | 4 +- .../testdata/constraint/where_self.carbon | 4 +- .../convert_run.carbon | 4 +- .../testdata/function/convert_args.carbon | 6 +- .../generic_class/class_function.carbon | 4 +- .../generic_class/fail_args_mismatch.carbon | 4 +- .../fail_bad_parameter_type.carbon | 4 +- .../generic_class/fail_no_args.carbon | 4 +- .../generic_class/fail_self_with_arg.carbon | 4 +- .../generic_class/fail_two_arg_lists.carbon | 4 +- .../generic_class_substitution.carbon | 4 +- .../generic_fun_and_class.carbon | 4 +- .../generic_class/generic_point.carbon | 4 +- .../generic_class/impl_with_argument.carbon | 12 +- .../generic_class/impl_with_self.carbon | 12 +- .../param_with_dependent_type.carbon | 2 +- .../generic_class/point_with_interface.carbon | 12 +- .../testdata/generic_class/use_self.carbon | 4 +- .../generic_function/generic_method.carbon | 12 +- .../implicit_conversion.carbon | 4 +- .../implicit_conversion.carbon | 2 +- .../testdata/if_else/convert_condition.carbon | 4 +- .../if_expression/convert_condition.carbon | 4 +- .../testdata/impl/fail_ambiguous_impl.carbon | 20 +- .../impl/fail_unambiguous_impl_generic.carbon | 20 +- .../testdata/impl/generic_method_impl.carbon | 16 +- .../impl/impl_in_generic_class.carbon | 4 +- explorer/testdata/impl/param_impl.carbon | 8 +- explorer/testdata/impl/param_impl2.carbon | 8 +- .../testdata/impl/param_impl_with_self.carbon | 8 +- .../testdata/interface/class_function.carbon | 12 +- .../interface/constrained_parameter.carbon | 28 +- .../external_impl_point_vector.carbon | 12 +- .../interface/external_impl_use_self.carbon | 12 +- .../fail_external_impl_omit_self.carbon | 12 +- .../interface/fail_external_impl_self.carbon | 12 +- .../interface/fail_impl_bad_member.carbon | 10 +- .../interface/fail_impl_missing_member.carbon | 8 +- .../fail_interface_missing_member.carbon | 6 +- .../testdata/interface/fail_no_impl.carbon | 4 +- .../interface/generic_call_generic.carbon | 12 +- .../interface/generic_with_two_params.carbon | 20 +- .../impl_self_interface_parameter.carbon | 6 +- explorer/testdata/interface/omit_self.carbon | 12 +- .../param_with_dependent_type.carbon | 4 +- .../testdata/interface/parameterized.carbon | 12 +- .../interface/tuple_vector_add_scale.carbon | 12 +- .../interface/vector_point_add_scale.carbon | 12 +- explorer/testdata/interface/with_self.carbon | 12 +- explorer/testdata/let/fail_method_args.carbon | 2 +- .../testdata/let/implicit_conversion.carbon | 2 +- .../let/implicit_conversion_choice.carbon | 2 +- explorer/testdata/match/convert.carbon | 2 +- .../match/fail_pattern_type_mismatch.carbon | 2 +- .../member_access/convert_lhs_class.carbon | 4 +- .../convert_lhs_interface.carbon | 6 +- .../evaluate_type_before_dot.carbon | 4 +- .../fail_qualified_non_member.carbon | 2 +- ...acuous_access_with_instance_binding.carbon | 4 +- .../param_qualified_interface_member.carbon | 4 +- .../qualified_class_member.carbon | 2 +- .../qualified_constraint_member.carbon | 4 +- .../qualified_interface_member.carbon | 4 +- .../qualified_param_member.carbon | 4 +- .../name_lookup/class_fn_body_reorder.carbon | 6 +- .../return/convert_return_value.carbon | 2 +- .../testdata/while/convert_condition.carbon | 4 +- highlighting/highlightjs_carbon_lang.js | 12 +- highlighting/highlightjs_example.html | 12 +- third_party/examples/re2/re2.carbon | 138 +++--- 182 files changed, 1273 insertions(+), 1267 deletions(-) rename explorer/fuzzing/fuzzer_corpus/{5a5e0f23676f5b95ddb2d0101131f22c1fc5515c => 01470906214372a9d64519f51bc84e89760838fc} (98%) rename explorer/fuzzing/fuzzer_corpus/{f986b7976441ebd0928d8f4d13c6ff2be6a05f50 => 080504266a82cac1647fe47577ec3d03fc8f1e0b} (97%) rename explorer/fuzzing/fuzzer_corpus/{d829468ac733b7dd5677070c722c3c7ecd34c496 => 10262aa9c545ac25ae1cd7ccd0cdd7ad758ad1d8} (97%) rename explorer/fuzzing/fuzzer_corpus/{9a79849f37e616453382dcd0ff273c080d3b4f7f => 1b44103acf7ff5b98059b6ad83dfa87af4c820ca} (98%) rename explorer/fuzzing/fuzzer_corpus/{72624c04b293dcee7ecc0129b6e196195ca84332 => 1dd799e27118a9b31c58732b5536bb969d5dec47} (98%) rename explorer/fuzzing/fuzzer_corpus/{cc53603327b15d1ec403cb0d83a7b65e388baa10 => 1ed6b0aaabbdb804a00c5f9de15e87bcea7b2989} (97%) rename explorer/fuzzing/fuzzer_corpus/{c9bb494385213d19905103032c24c394b4c1a363 => 1feb91d5bdcaaa895ac4bdc8144dae56a77af690} (97%) rename explorer/fuzzing/fuzzer_corpus/{2caf42dcf02bff184fa653bf36054b9d83704e30 => 21fb9b4ef5f3cb228ced87f428683058b6ec9d0f} (98%) rename explorer/fuzzing/fuzzer_corpus/{6f589265e1e503d2e01043d6a332026d1693095e => 23acc22cb4275aa5e0e8709621fc88d7c780ea62} (97%) rename explorer/fuzzing/fuzzer_corpus/{538556cd683ca838d1ffefb154cda7a804b3eafe => 2b19e350556fbbc1d4821da650b3cf0d17148ae9} (98%) rename explorer/fuzzing/fuzzer_corpus/{87081db4d0965def5a5a56b274d6c38473f15367 => 2df14ada752970f5920c267c33f0308ef50f0246} (97%) rename explorer/fuzzing/fuzzer_corpus/{099a7eccb906876e50a4d9e1725e3a9adcc8a742 => 304589d53b5ac70ae5b20bfb211e9ef2ef89c303} (99%) rename explorer/fuzzing/fuzzer_corpus/{32e0eb929035d7c53b3d8566ac48ef0c3b82b32e => 38e8259579859a4b14e6589509b1c58c427e5e50} (98%) rename explorer/fuzzing/fuzzer_corpus/{b1573ca8e10fba91022153f79d51a3a8cd989c98 => 399e83ac13c818d8ade85dda1d4918aa459186c9} (98%) rename explorer/fuzzing/fuzzer_corpus/{91e906e0d538a96c1414d805872f0a3159529471 => 3bc84abaa7693f3ca0f0681f6f1097e1766d9d89} (98%) rename explorer/fuzzing/fuzzer_corpus/{e4909f9f7d6923c33db7e3dd3e292860721acfd3 => 3eb39ab6dba8cea78c2daebaf486a6be626ae7a6} (97%) rename explorer/fuzzing/fuzzer_corpus/{06a307aa1f2980c9c38aec7f31dc5c6c2cdb29f9 => 3ed8ca560ef34c454714552d051ec8d184dda8c3} (98%) rename explorer/fuzzing/fuzzer_corpus/{a04fd176eb32a1a2500bf298f4f5deb37b9fa406 => 4511704cda32c21450acb1f1442ecc9f1979e9a5} (99%) rename explorer/fuzzing/fuzzer_corpus/{1844089b39db6518836420fcb6a5d37b3e99424f => 5a5456f6259ac15d8358430389aea12f145a44f7} (97%) rename explorer/fuzzing/fuzzer_corpus/{ad532018fa2a099d303e2439b0c39557aecf8e00 => 5b0eabed769a089e9906772fe0dfc78b111fee38} (97%) rename explorer/fuzzing/fuzzer_corpus/{fe3c5db046e0dae74603f2c43ed1af68eea9a6ae => 5bd03bcc54eb9664e91595ce320d14f133233e73} (97%) rename explorer/fuzzing/fuzzer_corpus/{6387e3e0d1ddb4ad2178b62b08b5812d4181fc75 => 5c1540feb494c79e5f20e6f87651be05325cac4b} (98%) rename explorer/fuzzing/fuzzer_corpus/{b2bb0268ca91b380d18d8b4e26f8188830ad584b => 6318884693dd31430b4b46b1305dae63f281751e} (97%) rename explorer/fuzzing/fuzzer_corpus/{8807065998e566eda4a26e9d9ec50f8938b46253 => 64618fd348511e00ac19df9a99ac61329f13235a} (98%) rename explorer/fuzzing/fuzzer_corpus/{3db1646f25e3f628cf0219a651539b07f20df403 => 6767a2eb95f450545192b2ad69022bcbfe0ec98d} (99%) rename explorer/fuzzing/fuzzer_corpus/{b3be1b28b64d4a3b2da9d7a2da48e4094e7102bf => 68a5800e6a2dbe2f732129fe874f20bbb42b90b5} (97%) rename explorer/fuzzing/fuzzer_corpus/{6c86299b17c54466628587a48c2ec0e9d3029fc7 => 69085645b1858d4812fa018eb8c1addb630253d1} (97%) rename explorer/fuzzing/fuzzer_corpus/{0ee3d72e3cab1b0907f04f35b2d33fb946ab32c9 => 6a7199401d7f3938c79c0e967ebea78837a94a95} (97%) rename explorer/fuzzing/fuzzer_corpus/{259e262f9509cb8a3e564d29d397ae42670b3c9c => 6a879cdde713ac9009864ed5f9912616d314e017} (98%) rename explorer/fuzzing/fuzzer_corpus/{f7aeea2890977521805eb676011bb0223b46872f => 6b2bafceac3d58159bd93269556e1db2ea9c1470} (98%) rename explorer/fuzzing/fuzzer_corpus/{b77f65badb388ae3942c31237a85c8826c4e5648 => 6c25c16bd50745570b78bee439871f5d6a0ca621} (98%) rename explorer/fuzzing/fuzzer_corpus/{b77f0f9be78ea2cf33d09e3ac7991e7560b8279f => 781ecc36990e2394a0c6823855c583aae691bc78} (96%) rename explorer/fuzzing/fuzzer_corpus/{74c8e2e43c65d4be09ca220e6512569aeecec513 => 7da9f665980aa154e3e04524ab6284d08ede8f80} (99%) rename explorer/fuzzing/fuzzer_corpus/{0c441139ce210274afe7f2964745701c9957c672 => 7eabea18523cea963d3c7b0150afb7101805e32f} (97%) rename explorer/fuzzing/fuzzer_corpus/{d44b1b3f6ff018d0829e0d73f551d0144b39e638 => 8188e039b6d4d48035b5f86993575212c01d248a} (97%) rename explorer/fuzzing/fuzzer_corpus/{afa03ca87919d5338ae7a96eea4047ff62d7bfc6 => 82280e14d4c28c51272136e746d7f54c25095951} (97%) rename explorer/fuzzing/fuzzer_corpus/{472b9f7d613316693d56e49f236877cde0caaa75 => 826fa4abee30374c115463db29d4a94c4ca3c98f} (98%) rename explorer/fuzzing/fuzzer_corpus/{81b5d416277f5b28d98ac9b175f73389d9857655 => 864211adf7c5880a4c7862aed73b7ac0ac32b8a9} (97%) rename explorer/fuzzing/fuzzer_corpus/{b66e41a2708c436beb8806408f41f8b6d037cc87 => 8e41e48db8e0f14feea263e6c49c835b1b2ce53f} (98%) rename explorer/fuzzing/fuzzer_corpus/{7b7e24319e8f63e6c3e99f8cbc81da7e9e47390a => 97d6542094ef4b6e4322cddf33f59440c5b6ea61} (97%) rename explorer/fuzzing/fuzzer_corpus/{308d94ff5bf03c10d183bace81bc2f3641a68311 => 981655702b85acf10978cdb81df86b9399788092} (99%) rename explorer/fuzzing/fuzzer_corpus/{b9378e44d8b809e19d29c58997a302f6596c34e5 => 9c9fc5cca447d05d54f0200271e4cc6d228fe056} (98%) rename explorer/fuzzing/fuzzer_corpus/{99aed9e0efcdc0473a19a23e77d687971bf6fb08 => 9e4121f79f2fee85e9964bebf21543de57c1d439} (97%) rename explorer/fuzzing/fuzzer_corpus/{f0249ef671686916199dbce1467d741102a68717 => a394d42f77cdc9659ff63881715f4852eea0a3af} (98%) rename explorer/fuzzing/fuzzer_corpus/{017a765e283355ded618ed95de5da4e3f2dd4b52 => a5808cf255331e29840cb6878f8a4732c4bd6a08} (97%) rename explorer/fuzzing/fuzzer_corpus/{7f14266137c07dea7d4c7fa0f7f2ca6346cf4c66 => a63c576d4b2e1a63c3f9b960c861f9ba7513bb67} (98%) rename explorer/fuzzing/fuzzer_corpus/{5e4bce73c210e45269126773f257d95d4d269072 => a71bb2c74fc34cb14adf428db9dd48e6ada14bb6} (97%) rename explorer/fuzzing/fuzzer_corpus/{35a3028fcdb70945c6c7db9e7154b08543f0dc17 => b1f2cfe33f8d50f38ce8addd62b76519bd589d9e} (97%) rename explorer/fuzzing/fuzzer_corpus/{b015582cdd9a7b03f83d7001537d32e4ea123946 => b32e22f8b9b251438cf5d689f5f077daaa3f3bdf} (98%) rename explorer/fuzzing/fuzzer_corpus/{fda984fd483f47ca29fd55b54173f77ef690b4ee => b8c12a825a41b0b25af0f44a119d6993f90af611} (99%) rename explorer/fuzzing/fuzzer_corpus/{a88508d94032d0429d1cba11c1df90deb142c155 => b8e05ecd5da75a6af34295d2396d27fec1cfd4d5} (97%) rename explorer/fuzzing/fuzzer_corpus/{b671a41b29603d99d57b69e15c8ee86017b58555 => be2a3f66b52634d15b9e34c0ed93ce8ffebcd527} (98%) rename explorer/fuzzing/fuzzer_corpus/{5357de7edef4e3bff993192d9538493ae80f5fa8 => c0f26047718df883b42cab5fd891a7a58663d5fd} (97%) rename explorer/fuzzing/fuzzer_corpus/{ad6c39ea6ec9ed5867500173d2aaa1200bbc06a6 => c2646dc4add2384ca4c733a9a706b218397cc1c8} (97%) rename explorer/fuzzing/fuzzer_corpus/{f322da95d8d8422e659c3c23d2f7aa3193efb25f => c7d4d21e67b7c6a1f952e22f81fcb158a53e208d} (98%) rename explorer/fuzzing/fuzzer_corpus/{9bb0b055035cb4965aa9432c34bdb1be0f8c3b80 => cd31cdffa19ef031d14c0d3440a7d14f2433b923} (97%) rename explorer/fuzzing/fuzzer_corpus/{63979179f0b4279dbf7a98a3a7b9837393d43e8a => ce85fb106849dde89ccc11e6ff799faa8c74af07} (98%) rename explorer/fuzzing/fuzzer_corpus/{06f83aef3f9e01311a3278cd23a2abc77c49915f => ce8a72d8214224c0cf6cd1208452aa86ddb41a3c} (98%) rename explorer/fuzzing/fuzzer_corpus/{d415017d19f5638734278f41adaa345e510f90d2 => d1e5a00347368e94959ff07b93e4c6a0762091a8} (97%) rename explorer/fuzzing/fuzzer_corpus/{6feffd83f7b5bfd3f870e4365a8c0d58df0689b4 => d438d10996b2ac3415accec527ba50adeda7a500} (97%) rename explorer/fuzzing/fuzzer_corpus/{03db728d09b4ef55c73a6cf6c16bb6b7b53e3fc4 => d4b10085400853e130d2f552d6493df76d33e24a} (97%) rename explorer/fuzzing/fuzzer_corpus/{9ada7039985bcf2aeea353a2e74e93cfdc8b432e => e18e54955a7d12d8676a628f6a8a2a700d09394d} (97%) rename explorer/fuzzing/fuzzer_corpus/{5def149b950eae9d5fae3e3fadbdfc1e0d322cbc => e3b3b1f52b6d35189726bae3b49d358f1eda35d6} (98%) rename explorer/fuzzing/fuzzer_corpus/{9a73b722edc48fc49e85c9221d5cdd6423f8f38a => e6c980db2dc247d290d0bef72b045ddb3bc9e712} (96%) rename explorer/fuzzing/fuzzer_corpus/{8fa92df904a230ee4b0ecf1362170a2551aec98b => eebcd02d851ed64b1185b3eaa0b4d23f49189e06} (97%) rename explorer/fuzzing/fuzzer_corpus/{51a6ff8051dffb6bc7c57b437a526d8f1ed37a57 => eeffdec7cdffe7258413447330e745427673be5b} (98%) rename explorer/fuzzing/fuzzer_corpus/{fc5f5e4f348579cedbecae8dccafc9f9dae68237 => ef9e4ddee87e9a1551d2cf0f56c2b2698d6000c0} (98%) rename explorer/fuzzing/fuzzer_corpus/{522da9a0308eba58c432f7aa35e79b795467ca21 => f2dfd518c2577c93096166bb98f1155256906d0b} (98%) rename explorer/fuzzing/fuzzer_corpus/{2584c688c48bb0fcc5f1b1f91292e0688e759cd0 => f3efad50612502cd8b950bcac04915a6955c69bb} (96%) rename explorer/fuzzing/fuzzer_corpus/{65fd2bf8e57cee5e4dd1168a3ef1d46b352d1e61 => f7e287c201224da259cfdf413438115348e5f54a} (97%) rename explorer/fuzzing/fuzzer_corpus/{713cf9469d63bd75c1e35014758c535d04427ac1 => f7f6d87bd21a9da0681c8728d40a6fd62dcd9ea7} (98%) rename explorer/fuzzing/fuzzer_corpus/{4ee491109d08f78764e3ed9a59f36521e348650b => fcbce51b08fb96910190bccab95620d12d64e5e2} (97%) rename explorer/testdata/addr/{fail-method-me-type.carbon => fail-method-self-type.carbon} (77%) diff --git a/docs/design/README.md b/docs/design/README.md index aed9c2bf4d6e2..202c13687350f 100644 --- a/docs/design/README.md +++ b/docs/design/README.md @@ -1301,22 +1301,22 @@ Class type definitions can include methods: ```carbon class Point { // Method defined inline - fn Distance[me: Self](x2: i32, y2: i32) -> f32 { - var dx: i32 = x2 - me.x; - var dy: i32 = y2 - me.y; + fn Distance[self: Self](x2: i32, y2: i32) -> f32 { + var dx: i32 = x2 - self.x; + var dy: i32 = y2 - self.y; return Math.Sqrt(dx * dx - dy * dy); } // Mutating method - fn Offset[addr me: Self*](dx: i32, dy: i32); + fn Offset[addr self: Self*](dx: i32, dy: i32); var x: i32; var y: i32; } // Out-of-line definition of method declared inline. -fn Point.Offset[addr me: Self*](dx: i32, dy: i32) { - me->x += dx; - me->y += dy; +fn Point.Offset[addr self: Self*](dx: i32, dy: i32) { + self->x += dx; + self->y += dy; } var origin: Point = {.x = 0, .y = 0}; @@ -1328,16 +1328,16 @@ Assert(origin.Distance(3, 4) == 0.0); This defines a `Point` class type with two integer data members `x` and `y` and two methods `Distance` and `Offset`: -- Methods are defined as class functions with a `me` parameter inside square +- Methods are defined as class functions with a `self` parameter inside square brackets `[`...`]` before the regular explicit parameter list in parens `(`...`)`. - Methods are called using using the member syntax, `origin.Distance(`...`)` and `origin.Offset(`...`)`. - `Distance` computes and returns the distance to another point, without - modifying the `Point`. This is signified using `[me: Self]` in the method + modifying the `Point`. This is signified using `[self: Self]` in the method declaration. - `origin.Offset(`...`)` does modify the value of `origin`. This is signified - using `[addr me: Self*]` in the method declaration. + using `[addr self: Self*]` in the method declaration. - Methods may be declared lexically inline like `Distance`, or lexically out of line like `Offset`. @@ -1481,12 +1481,12 @@ names resolvable by the compiler, and don't act like forward declarations. A destructor for a class is custom code executed when the lifetime of a value of that type ends. They are defined with the `destructor` keyword followed by -either `[me: Self]` or `[addr me: Self*]` (as is done with [methods](#methods)) -and the block of code in the class definition, as in: +either `[self: Self]` or `[addr self: Self*]` (as is done with +[methods](#methods)) and the block of code in the class definition, as in: ```carbon class MyClass { - destructor [me: Self] { ... } + destructor [self: Self] { ... } } ``` @@ -1494,8 +1494,8 @@ or: ```carbon class MyClass { - // Can modify `me` in the body. - destructor [addr me: Self*] { ... } + // Can modify `self` in the body. + destructor [addr self: Self*] { ... } } ``` @@ -2147,7 +2147,7 @@ capabilities that may be assumed of types that satisfy that constraint. interface Printable { // Inside an interface definition `Self` means // "the type implementing this interface". - fn Print[me: Self](); + fn Print[self: Self](); } ``` @@ -2170,8 +2170,8 @@ class Circle { var radius: f32; impl as Printable { - fn Print[me: Self]() { - Console.WriteLine("Circle with radius: {0}", me.radius); + fn Print[self: Self]() { + Console.WriteLine("Circle with radius: {0}", self.radius); } } } @@ -2264,9 +2264,9 @@ associated type to represent the type of elements stored in the stack. ``` interface StackInterface { let ElementType:! Movable; - fn Push[addr me: Self*](value: ElementType); - fn Pop[addr me: Self*]() -> ElementType; - fn IsEmpty[addr me: Self*]() -> bool; + fn Push[addr self: Self*](value: ElementType); + fn Pop[addr self: Self*]() -> ElementType; + fn IsEmpty[addr self: Self*]() -> bool; } ``` @@ -2276,14 +2276,14 @@ values for the `ElementType` member of the interface using a `where` clause: ```carbon class IntStack { impl as StackInterface where .ElementType == i32 { - fn Push[addr me: Self*](value: i32); + fn Push[addr self: Self*](value: i32); // ... } } class FruitStack { impl as StackInterface where .ElementType == Fruit { - fn Push[addr me: Self*](value: Fruit); + fn Push[addr self: Self*](value: Fruit); // ... } } @@ -2311,8 +2311,8 @@ type `T`: ```carbon class Stack(T:! Type) { - fn Push[addr me: Self*](value: T); - fn Pop[addr me: Self*]() -> T; + fn Push[addr self: Self*](value: T); + fn Pop[addr self: Self*]() -> T; var storage: Array(T); } @@ -2513,7 +2513,7 @@ types in the `impl` declaration, as in: ```carbon external impl like T as AddWith(like U) where .Result == V { // `Self` is `T` here - fn Op[me: Self](other: U) -> V { ... } + fn Op[self: Self](other: U) -> V { ... } } ``` @@ -2522,7 +2522,7 @@ implementing the `Add` interface: ```carbon external impl T as Add { - fn Op[me: Self](other: Self) -> Self { ... } + fn Op[self: Self](other: Self) -> Self { ... } } ``` diff --git a/docs/design/classes.md b/docs/design/classes.md index e5a9da6bd3f73..475c050ea113c 100644 --- a/docs/design/classes.md +++ b/docs/design/classes.md @@ -865,25 +865,25 @@ var p2: Point = p1.CreateCentered(); [Method]() declarations are distinguished from [class function](#class-functions) -declarations by having a `me` parameter in square brackets `[`...`]` before the -explicit parameter list in parens `(`...`)`. There is no implicit member access -in methods, so inside the method body members are accessed through the `me` -parameter. Methods may be written lexically inline or after the class +declarations by having a `self` parameter in square brackets `[`...`]` before +the explicit parameter list in parens `(`...`)`. There is no implicit member +access in methods, so inside the method body members are accessed through the +`self` parameter. Methods may be written lexically inline or after the class declaration. ```carbon class Circle { - fn Diameter[me: Self]() -> f32 { - return me.radius * 2; + fn Diameter[self: Self]() -> f32 { + return self.radius * 2; } - fn Expand[addr me: Self*](distance: f32); + fn Expand[addr self: Self*](distance: f32); var center: Point; var radius: f32; } -fn Circle.Expand[addr me: Self*](distance: f32) { - me->radius += distance; +fn Circle.Expand[addr self: Self*](distance: f32) { + self->radius += distance; } var c: Circle = {.center = Point.Origin(), .radius = 1.5 }; @@ -895,10 +895,10 @@ Assert(Math.Abs(c.Diameter() - 4.0) < 0.001); - Methods are called using using the dot `.` member syntax, `c.Diameter()` and `c.Expand(`...`)`. - `Diameter` computes and returns the diameter of the circle without modifying - the `Circle` instance. This is signified using `[me: Self]` in the method + the `Circle` instance. This is signified using `[self: Self]` in the method declaration. - `c.Expand(`...`)` does modify the value of `c`. This is signified using - `[addr me: Self*]` in the method declaration. + `[addr self: Self*]` in the method declaration. The pattern '`addr` _patt_' means "first take the address of the argument, which must be an @@ -907,8 +907,8 @@ then match pattern _patt_ against it". If the method declaration also includes [deduced generic parameters](/docs/design/generics/overview.md#deduced-parameters), -the `me` parameter must be in the same list in square brackets `[`...`]`. The -`me` parameter may appear in any position in that list, as long as it appears +the `self` parameter must be in the same list in square brackets `[`...`]`. The +`self` parameter may appear in any position in that list, as long as it appears after any names needed to describe its type. #### Name lookup in member function definitions @@ -916,17 +916,17 @@ after any names needed to describe its type. When defining a member function lexically inline, we delay type checking of the function body until the definition of the current type is complete. This means that name lookup _for members of objects_ is also delayed. That means that you -can reference `me.F()` in a lexically inline method definition even before the +can reference `self.F()` in a lexically inline method definition even before the declaration of `F` in that class definition. However, other names still need to be declared before they are used. This includes unqualified names, names within namespaces, and names _for members of types_. ``` class Point { - fn Distance[me: Self]() -> f32 { + fn Distance[self: Self]() -> f32 { // ✅ Allowed: `x` and `y` are names for members of an object, - // and so lookup is delayed until `type_of(me) == Self` is complete. - return Math.Sqrt(me.x * me.x + me.y * me.y); + // and so lookup is delayed until `type_of(self) == Self` is complete. + return Math.Sqrt(self.x * self.x + self.y * self.y); } fn CreatePolarInvalid(r: f32, theta: f32) -> Point { @@ -955,7 +955,7 @@ class Point { fn CreateXAxis(x: f32) -> Point; - fn Angle[me: Self]() -> f32; + fn Angle[self: Self]() -> f32; var x: f32; var y: f32; @@ -967,10 +967,10 @@ fn Point.CreateXAxis(x: f32) -> Point; return Create(x, 0); } -fn Point.Angle[me: Self]() -> f32 { +fn Point.Angle[self: Self]() -> f32 { // ✅ Allowed: `Point` type is complete. // Function is checked immediately. - return Math.ATan2(me.y, me.x); + return Math.ATan2(self.y, self.x); } ``` @@ -1127,7 +1127,7 @@ declaration before `fn`. ``` base class MyBaseClass { - virtual fn Overridable[me: Self]() -> i32 { return 7; } + virtual fn Overridable[self: Self]() -> i32 { return 7; } } ``` @@ -1418,7 +1418,7 @@ the `destructor` keyword: ```carbon class MyClass { - destructor [me: Self] { ... } + destructor [self: Self] { ... } } ``` @@ -1426,13 +1426,13 @@ or: ```carbon class MyClass { - // Can modify `me` in the body. - destructor [addr me: Self*] { ... } + // Can modify `self` in the body. + destructor [addr self: Self*] { ... } } ``` If a class has no `destructor` declaration, it gets the default destructor, -which is equivalent to `destructor [me: Self] { }`. +which is equivalent to `destructor [self: Self] { }`. The destructor for a class is run before the destructors of its data members. The data members are destroyed in reverse order of declaration. Derived classes @@ -1450,9 +1450,9 @@ Destructors may be declared in class scope and then defined out-of-line: ```carbon class MyClass { - destructor [addr me: Self*]; + destructor [addr self: Self*]; } -destructor MyClass [addr me: Self*] { ... } +destructor MyClass [addr self: Self*] { ... } ``` It is illegal to delete an instance of a derived class through a pointer to one @@ -1464,11 +1464,11 @@ must be `impl`: ```carbon base class MyBaseClass { - virtual destructor [addr me: Self*] { ... } + virtual destructor [addr self: Self*] { ... } } class MyDerivedClass extends MyBaseClass { - impl destructor [addr me: Self*] { ... } + impl destructor [addr self: Self*] { ... } } ``` @@ -1518,8 +1518,8 @@ call the `UnsafeDelete` method instead. Note that you may not call ``` interface Allocator { // ... - fn Delete[T:! Deletable, addr me: Self*](p: T*); - fn UnsafeDelete[T:! Destructible, addr me: Self*](p: T*); + fn Delete[T:! Deletable, addr self: Self*](p: T*); + fn UnsafeDelete[T:! Destructible, addr self: Self*](p: T*); } ``` @@ -1566,7 +1566,7 @@ could potentially fail must be performed before the destructor is called. Unhandled failure during a destructor call will abort the program. **Future work:** Allow or require destructors to be declared as taking -`[var me: Self]`. +`[var self: Self]`. **Alternatives considered:** @@ -1630,7 +1630,7 @@ As in C++, `private` means only accessible to members of the class and any ```carbon class Point { - fn Distance[me: Self]() -> f32; + fn Distance[self: Self]() -> f32; // These are only accessible to members of `Point`. private var x: f32; private var y: f32; @@ -1668,15 +1668,15 @@ derived classes, and any [friends](#friends). ``` base class MyBaseClass { protected fn HelperClassFunction(x: i32) -> i32; - protected fn HelperMethod[me: Self](x: i32) -> i32; + protected fn HelperMethod[self: Self](x: i32) -> i32; protected var data: i32; } class MyDerivedClass extends MyBaseClass { - fn UsesProtected[addr me: Self*]() { + fn UsesProtected[addr self: Self*]() { // Can access protected members in derived class var x: i32 = HelperClassFunction(3); - me->data = me->HelperMethod(x); + self->data = self->HelperMethod(x); } } ``` diff --git a/docs/design/expressions/README.md b/docs/design/expressions/README.md index 3603f2dfc493f..cae8c4eb058e6 100644 --- a/docs/design/expressions/README.md +++ b/docs/design/expressions/README.md @@ -232,9 +232,9 @@ with parentheses around the member name: - _expression_ `.` `(` _expression_ `)` ``` -interface I { fn F[me: Self](); } +interface I { fn F[self: Self](); } class X {} -external impl X as I { fn F[me: Self]() {} } +external impl X as I { fn F[self: Self]() {} } // `x.I.F()` would mean `(x.I).F()`. fn Q(x: X) { x.(I.F)(); } diff --git a/docs/design/expressions/arithmetic.md b/docs/design/expressions/arithmetic.md index 6b3d2fcb395e5..ea05a91859696 100644 --- a/docs/design/expressions/arithmetic.md +++ b/docs/design/expressions/arithmetic.md @@ -194,7 +194,7 @@ following family of interfaces: // Unary `-`. interface Negate { let Result:! Type = Self; - fn Op[me: Self]() -> Result; + fn Op[self: Self]() -> Result; } ``` @@ -202,7 +202,7 @@ interface Negate { // Binary `+`. interface AddWith(U:! Type) { let Result:! Type = Self; - fn Op[me: Self](other: U) -> Result; + fn Op[self: Self](other: U) -> Result; } constraint Add { extends AddWith(Self) where .Result = Self; @@ -213,7 +213,7 @@ constraint Add { // Binary `-`. interface SubWith(U:! Type) { let Result:! Type = Self; - fn Op[me: Self](other: U) -> Result; + fn Op[self: Self](other: U) -> Result; } constraint Sub { extends SubWith(Self) where .Result = Self; @@ -224,7 +224,7 @@ constraint Sub { // Binary `*`. interface MulWith(U:! Type) { let Result:! Type = Self; - fn Op[me: Self](other: U) -> Result; + fn Op[self: Self](other: U) -> Result; } constraint Mul { extends MulWith(Self) where .Result = Self; @@ -235,7 +235,7 @@ constraint Mul { // Binary `/`. interface DivWith(U:! Type) { let Result:! Type = Self; - fn Op[me: Self](other: U) -> Result; + fn Op[self: Self](other: U) -> Result; } constraint Div { extends DivWith(Self) where .Result = Self; @@ -246,7 +246,7 @@ constraint Div { // Binary `%`. interface ModWith(U:! Type) { let Result:! Type = Self; - fn Op[me: Self](other: U) -> Result; + fn Op[self: Self](other: U) -> Result; } constraint Mod { extends ModWith(Self) where .Result = Self; diff --git a/docs/design/expressions/as_expressions.md b/docs/design/expressions/as_expressions.md index fb6ffc301f7ef..83cefe77a5814 100644 --- a/docs/design/expressions/as_expressions.md +++ b/docs/design/expressions/as_expressions.md @@ -165,7 +165,7 @@ Explicit casts can be defined for user-defined types such as ``` interface As(Dest:! Type) { - fn Convert[me: Self]() -> Dest; + fn Convert[self: Self]() -> Dest; } ``` diff --git a/docs/design/expressions/bitwise.md b/docs/design/expressions/bitwise.md index 87b0d775d3739..2e36ecdc44304 100644 --- a/docs/design/expressions/bitwise.md +++ b/docs/design/expressions/bitwise.md @@ -198,7 +198,7 @@ implementing the following family of interfaces: // Unary `^`. interface BitComplement { let Result:! Type = Self; - fn Op[me: Self]() -> Result; + fn Op[self: Self]() -> Result; } ``` @@ -206,7 +206,7 @@ interface BitComplement { // Binary `&`. interface BitAndWith(U:! Type) { let Result:! Type = Self; - fn Op[me: Self](other: U) -> Result; + fn Op[self: Self](other: U) -> Result; } constraint BitAnd { extends BitAndWith(Self) where .Result = Self; @@ -217,7 +217,7 @@ constraint BitAnd { // Binary `|`. interface BitOrWith(U:! Type) { let Result:! Type = Self; - fn Op[me: Self](other: U) -> Result; + fn Op[self: Self](other: U) -> Result; } constraint BitOr { extends BitOrWith(Self) where .Result = Self; @@ -228,7 +228,7 @@ constraint BitOr { // Binary `^`. interface BitXorWith(U:! Type) { let Result:! Type = Self; - fn Op[me: Self](other: U) -> Result; + fn Op[self: Self](other: U) -> Result; } constraint BitXor { extends BitXorWith(Self) where .Result = Self; @@ -239,7 +239,7 @@ constraint BitXor { // Binary `<<`. interface LeftShiftWith(U:! Type) { let Result:! Type = Self; - fn Op[me: Self](other: U) -> Result; + fn Op[self: Self](other: U) -> Result; } constraint LeftShift { extends LeftShiftWith(Self) where .Result = Self; @@ -250,7 +250,7 @@ constraint LeftShift { // Binary `>>`. interface RightShiftWith(U:! Type) { let Result:! Type = Self; - fn Op[me: Self](other: U) -> Result; + fn Op[self: Self](other: U) -> Result; } constraint RightShift { extends RightShiftWith(Self) where .Result = Self; diff --git a/docs/design/expressions/comparison_operators.md b/docs/design/expressions/comparison_operators.md index 4836922bef1b0..42c2ee571e9ae 100644 --- a/docs/design/expressions/comparison_operators.md +++ b/docs/design/expressions/comparison_operators.md @@ -254,9 +254,9 @@ operators for a given pair of types: ``` interface EqWith(U:! Type) { - fn Equal[me: Self](u: U) -> bool; - default fn NotEqual[me: Self](u: U) -> bool { - return not (me == u); + fn Equal[self: Self](u: U) -> bool; + default fn NotEqual[self: Self](u: U) -> bool { + return not (self == u); } } constraint Eq { @@ -273,11 +273,11 @@ Given `x: T` and `y: U`: class Path { private var drive: String; private var path: String; - private fn CanonicalPath[me: Self]() -> String; + private fn CanonicalPath[self: Self]() -> String; external impl as Eq { - fn Equal[me: Self](other: Self) -> bool { - return (me.drive, me.CanonicalPath()) == + fn Equal[self: Self](other: Self) -> bool { + return (self.drive, self.CanonicalPath()) == (other.drive, other.CanonicalPath()); } } @@ -293,12 +293,12 @@ can be used: ``` class MyInt { var value: i32; - fn Value[me: Self]() -> i32 { return me.value; } + fn Value[self: Self]() -> i32 { return self.value; } } external impl i32 as ImplicitAs(MyInt); external impl like MyInt as EqWith(like MyInt) { - fn Equal[me: Self](other: Self) -> bool { - return me.Value() == other.Value(); + fn Equal[self: Self](other: Self) -> bool { + return self.Value() == other.Value(); } } fn CompareBothWays(a: MyInt, b: i32, c: MyInt) -> bool { @@ -316,17 +316,17 @@ operations should have no observable side-effects. ``` external impl like MyFloat as EqWith(like MyFloat) { - fn Equal[me: MyFloat](other: MyFloat) -> bool { - if (me.IsNaN() or other.IsNaN()) { + fn Equal[self: MyFloat](other: MyFloat) -> bool { + if (self.IsNaN() or other.IsNaN()) { return false; } - return me.Representation() == other.Representation(); + return self.Representation() == other.Representation(); } - fn NotEqual[me: MyFloat](other: MyFloat) -> bool { - if (me.IsNaN() or other.IsNaN()) { + fn NotEqual[self: MyFloat](other: MyFloat) -> bool { + if (self.IsNaN() or other.IsNaN()) { return false; } - return me.Representation() != other.Representation(); + return self.Representation() != other.Representation(); } } ``` @@ -354,19 +354,19 @@ choice Ordering { Incomparable } interface OrderedWith(U:! Type) { - fn Compare[me: Self](u: U) -> Ordering; - default fn Less[me: Self](u: U) -> bool { - return me.Compare(u) == Ordering.Less; + fn Compare[self: Self](u: U) -> Ordering; + default fn Less[self: Self](u: U) -> bool { + return self.Compare(u) == Ordering.Less; } - default fn LessOrEquivalent[me: Self](u: U) -> bool { - let c: Ordering = me.Compare(u); + default fn LessOrEquivalent[self: Self](u: U) -> bool { + let c: Ordering = self.Compare(u); return c == Ordering.Less or c == Ordering.Equivalent; } - default fn Greater[me: Self](u: U) -> bool { - return me.Compare(u) == Ordering.Greater; + default fn Greater[self: Self](u: U) -> bool { + return self.Compare(u) == Ordering.Greater; } - default fn GreaterOrEquivalent[me: Self](u: U) -> bool { - let c: Ordering = me.Compare(u); + default fn GreaterOrEquivalent[self: Self](u: U) -> bool { + let c: Ordering = self.Compare(u); return c == Ordering.Greater or c == Ordering.Equivalent; } } @@ -395,12 +395,12 @@ class MyWidget { var width: i32; var height: i32; - fn Size[me: Self]() -> i32 { return me.width * me.height; } + fn Size[self: Self]() -> i32 { return self.width * self.height; } // Widgets are normally ordered by size. external impl as Ordered { - fn Compare[me: Self](other: Self) -> Ordering { - return me.Size().(Ordered.Compare)(other.Size()); + fn Compare[self: Self](other: Self) -> Ordering { + return self.Size().(Ordered.Compare)(other.Size()); } } } @@ -420,8 +420,8 @@ fn ReverseOrdering(o: Ordering) -> Ordering { } external impl like MyInt as OrderedWith(like MyFloat); external impl like MyFloat as OrderedWith(like MyInt) { - fn Compare[me: Self](other: Self) -> Ordering { - return Reverse(other.(OrderedWith(Self).Compare)(me)); + fn Compare[self: Self](other: Self) -> Ordering { + return Reverse(other.(OrderedWith(Self).Compare)(self)); } } ``` diff --git a/docs/design/expressions/implicit_conversions.md b/docs/design/expressions/implicit_conversions.md index dc72cff454d38..ab63917063152 100644 --- a/docs/design/expressions/implicit_conversions.md +++ b/docs/design/expressions/implicit_conversions.md @@ -209,7 +209,7 @@ extends ``` interface ImplicitAs(Dest:! Type) extends As(Dest) { // Inherited from As(Dest): - // fn Convert[me: Self]() -> Dest; + // fn Convert[self: Self]() -> Dest; } ``` diff --git a/docs/design/expressions/member_access.md b/docs/design/expressions/member_access.md index 656800186180d..a5a71b7d02d91 100644 --- a/docs/design/expressions/member_access.md +++ b/docs/design/expressions/member_access.md @@ -55,7 +55,7 @@ For example: ```carbon package Widgets api; interface Widget { - fn Grow[addr me: Self*](factor: f64); + fn Grow[addr self: Self*](factor: f64); } class Cog { var size: i32; @@ -163,7 +163,7 @@ For example: ``` interface Printable { - fn Print[me: Self](); + fn Print[self: Self](); } external impl i32 as Printable; class Point { @@ -238,11 +238,11 @@ actual value of a generic parameter never affects the result of member resolution. ```carbon -class Cowboy { fn Draw[me: Self](); } +class Cowboy { fn Draw[self: Self](); } interface Renderable { - fn Draw[me: Self](); + fn Draw[self: Self](); } -external impl Cowboy as Renderable { fn Draw[me: Self](); } +external impl Cowboy as Renderable { fn Draw[self: Self](); } fn DrawDirect(c: Cowboy) { c.Draw(); } fn DrawGeneric[T:! Renderable](c: T) { c.Draw(); } fn DrawTemplate[template T:! Renderable](c: T) { c.Draw(); } @@ -258,13 +258,13 @@ fn Draw(c: Cowboy) { class RoundWidget { external impl as Renderable { - fn Draw[me: Self](); + fn Draw[self: Self](); } alias Draw = Renderable.Draw; } class SquareWidget { - fn Draw[me: Self]() {} + fn Draw[self: Self]() {} external impl as Renderable { alias Draw = Self.Draw; } @@ -303,7 +303,7 @@ expression. ```carbon interface Addable { // #1 - fn Add[me: Self](other: Self) -> Self; + fn Add[self: Self](other: Self) -> Self; // #2 default fn Sum[Seq:! Iterable where .ValueType = Self](seq: Seq) -> Self { // ... @@ -313,7 +313,7 @@ interface Addable { class Integer { impl as Addable { // #3 - fn Add[me: Self](other: Self) -> Self; + fn Add[self: Self](other: Self) -> Self; // #4, generated from default implementation for #2. // fn Sum[...](...); } @@ -368,13 +368,13 @@ the argument for the template parameter is known. ```carbon interface I { // #1 - default fn F[me: Self]() {} + default fn F[self: Self]() {} let N:! i32; } class C { impl as I where .N = 5 { // #2 - fn F[me: C]() {} + fn F[self: C]() {} } } @@ -413,13 +413,13 @@ naming the interface member as a member of the class. ```carbon interface Renderable { // #1 - fn Draw[me: Self](); + fn Draw[self: Self](); } class RoundWidget { external impl as Renderable { // #2 - fn Draw[me: Self](); + fn Draw[self: Self](); } // `Draw` names the member of the `Renderable` interface. alias Draw = Renderable.Draw; @@ -427,7 +427,7 @@ class RoundWidget { class SquareWidget { // #3 - fn Draw[me: Self]() {} + fn Draw[self: Self]() {} external impl as Renderable { alias Draw = Self.Draw; } @@ -450,14 +450,14 @@ fn DrawWidget(r: RoundWidget, s: SquareWidget) { // ❌ Error: In the inner member access, the name `Draw` resolves to the // member `Draw` of `SquareWidget`, #3. // The outer member access fails because we can't call - // #3, `Draw[me: SquareWidget]()`, on a `RoundWidget` object `r`. + // #3, `Draw[self: SquareWidget]()`, on a `RoundWidget` object `r`. r.(SquareWidget.Draw)(); // ❌ Error: In the inner member access, the name `Draw` resolves to the // member `Draw` of `Renderable`, #1, which `impl` lookup replaces with // the member `Draw` of `impl RoundWidget as Renderable`, #2. // The outer member access fails because we can't call - // #2, `Draw[me: RoundWidget]()`, on a `SquareWidget` object `s`. + // #2, `Draw[self: RoundWidget]()`, on a `SquareWidget` object `s`. s.(RoundWidget.Draw)(); } @@ -511,19 +511,19 @@ value other than a type, then _instance binding_ is performed, as follows: - For a method, the result is a _bound method_, which is a value `F` such that a function call `F(args)` behaves the same as a call to `M(args)` with the - `me` parameter initialized by a corresponding recipient argument: + `self` parameter initialized by a corresponding recipient argument: - - If the method declares its `me` parameter with `addr`, the recipient + - If the method declares its `self` parameter with `addr`, the recipient argument is `&V`. - Otherwise, the recipient argument is `V`. ```carbon class Blob { - fn Mutate[addr me: Self*](n: i32); + fn Mutate[addr self: Self*](n: i32); } fn F(p: Blob*) { // ✅ OK, forms bound method `((*p).M)` and calls it. - // This calls `Blob.Mutate` with `me` initialized by `&(*p)` + // This calls `Blob.Mutate` with `self` initialized by `&(*p)` // and `n` initialized by `5`. (*p).Mutate(5); @@ -580,10 +580,10 @@ always used for lookup. ``` interface Printable { - fn Print[me: Self](); + fn Print[self: Self](); } external impl i32 as Printable { - fn Print[me: Self](); + fn Print[self: Self](); } fn MemberAccess(n: i32) { // ✅ OK: `Printable.Print` is the interface member. diff --git a/docs/design/generics/appendix-coherence.md b/docs/design/generics/appendix-coherence.md index 475a794de867f..6ccd10b870679 100644 --- a/docs/design/generics/appendix-coherence.md +++ b/docs/design/generics/appendix-coherence.md @@ -78,7 +78,7 @@ this: package SongHashArtistAndTitle; import SongLib; impl SongLib.Song as Hashable { - fn Hash[me: Self]() -> u64 { ... } + fn Hash[self: Self]() -> u64 { ... } } ``` @@ -105,7 +105,7 @@ this: package SongHashAppleMusicURL; import SongLib; impl SongLib.Song as Hashable { - fn Hash[me: Self]() -> u64 { ... } + fn Hash[self: Self]() -> u64 { ... } } ``` diff --git a/docs/design/generics/details.md b/docs/design/generics/details.md index 78828a8ec1eea..e7051310f7efc 100644 --- a/docs/design/generics/details.md +++ b/docs/design/generics/details.md @@ -224,8 +224,8 @@ have two methods: ``` interface Vector { // Here `Self` means "the type implementing this interface". - fn Add[me: Self](b: Self) -> Self; - fn Scale[me: Self](v: f64) -> Self; + fn Add[self: Self](b: Self) -> Self; + fn Scale[self: Self](v: f64) -> Self; } ``` @@ -258,10 +258,10 @@ class Point { var y: f64; impl as Vector { // In this scope, "Self" is an alias for "Point". - fn Add[me: Self](b: Self) -> Self { + fn Add[self: Self](b: Self) -> Self { return {.x = a.x + b.x, .y = a.y + b.y}; } - fn Scale[me: Self](v: f64) -> Self { + fn Scale[self: Self](v: f64) -> Self { return {.x = a.x * v, .y = a.y * v}; } } @@ -302,11 +302,11 @@ class Point { var x: f64; var y: f64; impl as Vector { - fn Add[me: Self](b: Self) -> Self { ... } - fn Scale[me: Self](v: f64) -> Self { ... } + fn Add[self: Self](b: Self) -> Self { ... } + fn Scale[self: Self](v: f64) -> Self { ... } } impl as Drawable { - fn Draw[me: Self]() { ... } + fn Draw[self: Self]() { ... } } } ``` @@ -319,13 +319,13 @@ below). ``` class GameBoard { impl as Drawable { - fn Draw[me: Self]() { ... } + fn Draw[self: Self]() { ... } } impl as EndOfGame { // ❌ Error: `GameBoard` has two methods named // `Draw` with the same signature. - fn Draw[me: Self]() { ... } - fn Winner[me: Self](player: i32) { ... } + fn Draw[self: Self]() { ... } + fn Winner[self: Self](player: i32) { ... } } } ``` @@ -339,14 +339,14 @@ experience. class Player { var name: String; impl as Icon { - fn Name[me: Self]() -> String { return me.name; } + fn Name[self: Self]() -> String { return self.name; } // ... } impl as GameUnit { // Possible syntax options for defining // `GameUnit.Name` as the same as `Icon.Name`: alias Name = Icon.Name; - fn Name[me: Self]() -> String = Icon.Name; + fn Name[self: Self]() -> String = Icon.Name; // ... } } @@ -365,10 +365,10 @@ class Point2 { external impl as Vector { // In this scope, `Self` is an alias for `Point2`. - fn Add[me: Self](b: Self) -> Self { + fn Add[self: Self](b: Self) -> Self { return {.x = a.x + b.x, .y = a.y + b.y}; } - fn Scale[me: Self](v: f64) -> Self { + fn Scale[self: Self](v: f64) -> Self { return {.x = a.x * v, .y = a.y * v}; } } @@ -390,10 +390,10 @@ class Point3 { external impl Point3 as Vector { // In this scope, `Self` is an alias for `Point3`. - fn Add[me: Self](b: Self) -> Self { + fn Add[self: Self](b: Self) -> Self { return {.x = a.x + b.x, .y = a.y + b.y}; } - fn Scale[me: Self](v: f64) -> Self { + fn Scale[self: Self](v: f64) -> Self { return {.x = a.x * v, .y = a.y * v}; } } @@ -435,12 +435,12 @@ scope. class Point4a { var x: f64; var y: f64; - fn Add[me: Self](b: Self) -> Self { + fn Add[self: Self](b: Self) -> Self { return {.x = a.x + b.x, .y = a.y + b.y}; } external impl as Vector { alias Add = Point4a.Add; // Syntax TBD - fn Scale[me: Self](v: f64) -> Self { + fn Scale[self: Self](v: f64) -> Self { return {.x = a.x * v, .y = a.y * v}; } } @@ -452,10 +452,10 @@ class Point4b { var x: f64; var y: f64; external impl as Vector { - fn Add[me: Self](b: Self) -> Self { + fn Add[self: Self](b: Self) -> Self { return {.x = a.x + b.x, .y = a.y + b.y}; } - fn Scale[me: Self](v: f64) -> Self { + fn Scale[self: Self](v: f64) -> Self { return {.x = a.x * v, .y = a.y * v}; } } @@ -467,14 +467,14 @@ class Point4b { class Point4c { var x: f64; var y: f64; - fn Add[me: Self](b: Self) -> Self { + fn Add[self: Self](b: Self) -> Self { return {.x = a.x + b.x, .y = a.y + b.y}; } } external impl Point4c as Vector { alias Add = Point4c.Add; // Syntax TBD - fn Scale[me: Self](v: f64) -> Self { + fn Scale[self: Self](v: f64) -> Self { return {.x = a.x * v, .y = a.y * v}; } } @@ -540,7 +540,7 @@ package Plot; import Points; interface Drawable { - fn Draw[me: Self](); + fn Draw[self: Self](); } external impl Points.Point3 as Drawable { ... } @@ -691,7 +691,7 @@ implementing `Vector`, and a function that takes a `GeneralPoint` and calls ``` class GeneralPoint(C:! Numeric) { external impl as Vector { ... } - fn Get[me: Self](i: i32) -> C; + fn Get[self: Self](i: i32) -> C; } fn CallWithGeneralPoint[C:! Numeric](p: GeneralPoint(C)) -> C { @@ -965,8 +965,8 @@ requirements of `I2`. This means a value `x` of type `T` may be passed to functions requiring types to satisfy `I2`, as in this example: ``` -interface Printable { fn Print[me: Self](); } -interface Renderable { fn Draw[me: Self](); } +interface Printable { fn Print[self: Self](); } +interface Renderable { fn Draw[self: Self](); } constraint PrintAndRender { impl as Printable; @@ -998,11 +998,11 @@ the union of the names minus any conflicts. ``` interface Printable { - fn Print[me: Self](); + fn Print[self: Self](); } interface Renderable { - fn Center[me: Self]() -> (i32, i32); - fn Draw[me: Self](); + fn Center[self: Self]() -> (i32, i32); + fn Draw[self: Self](); } // `Printable & Renderable` is syntactic sugar for this type-of-type: @@ -1023,11 +1023,11 @@ fn PrintThenDraw[T:! Printable & Renderable](x: T) { class Sprite { // ... impl as Printable { - fn Print[me: Self]() { ... } + fn Print[self: Self]() { ... } } impl as Renderable { - fn Center[me: Self]() -> (i32, i32) { ... } - fn Draw[me: Self]() { ... } + fn Center[self: Self]() -> (i32, i32) { ... } + fn Draw[self: Self]() { ... } } } @@ -1040,12 +1040,12 @@ error to use. ``` interface Renderable { - fn Center[me: Self]() -> (i32, i32); - fn Draw[me: Self](); + fn Center[self: Self]() -> (i32, i32); + fn Draw[self: Self](); } interface EndOfGame { - fn Draw[me: Self](); - fn Winner[me: Self](player: i32); + fn Draw[self: Self](); + fn Winner[self: Self](player: i32); } // `Renderable & EndOfGame` is syntactic sugar for this type-of-type: constraint { @@ -1152,10 +1152,10 @@ requires all containers to also satisfy the requirements of semantics and syntax as we do for [named constraints](#named-constraints): ``` -interface Equatable { fn Equals[me: Self](rhs: Self) -> bool; } +interface Equatable { fn Equals[self: Self](rhs: Self) -> bool; } interface Iterable { - fn Advance[addr me: Self*]() -> bool; + fn Advance[addr self: Self*]() -> bool; impl as Equatable; } @@ -1168,8 +1168,8 @@ def DoAdvanceAndEquals[T:! Iterable](x: T) { } class Iota { - impl as Iterable { fn Advance[me: Self]() { ... } } - impl as Equatable { fn Equals[me: Self](rhs: Self) -> bool { ... } } + impl as Iterable { fn Advance[self: Self]() { ... } } + impl as Equatable { fn Equals[self: Self](rhs: Self) -> bool { ... } } } var x: Iota; DoAdvanceAndEquals(x); @@ -1181,7 +1181,7 @@ declarations: ``` interface Hashable { - fn Hash[me: Self]() -> u64; + fn Hash[self: Self]() -> u64; impl as Equatable; alias Equals = Equatable.Equals; } @@ -1208,8 +1208,8 @@ as well. In the case of `Hashable` above, this includes all the members of ``` class Song { impl as Hashable { - fn Hash[me: Self]() -> u64 { ... } - fn Equals[me: Self](rhs: Self) -> bool { ... } + fn Hash[self: Self]() -> u64 { ... } + fn Equals[self: Self](rhs: Self) -> bool { ... } } } var y: Song; @@ -1228,17 +1228,17 @@ benefits: We expect this concept to be common enough to warrant dedicated syntax: ``` -interface Equatable { fn Equals[me: Self](rhs: Self) -> bool; } +interface Equatable { fn Equals[self: Self](rhs: Self) -> bool; } interface Hashable { extends Equatable; - fn Hash[me: Self]() -> u64; + fn Hash[self: Self]() -> u64; } // is equivalent to the definition of Hashable from before: // interface Hashable { // impl as Equatable; // alias Equals = Equatable.Equals; -// fn Hash[me: Self]() -> u64; +// fn Hash[self: Self]() -> u64; // } ``` @@ -1301,10 +1301,10 @@ The `extends` declaration makes sense with the same meaning inside a ``` interface Media { - fn Play[me: Self](); + fn Play[self: Self](); } interface Job { - fn Run[me: Self](); + fn Run[self: Self](); } constraint Combined { @@ -1333,8 +1333,8 @@ constraint: ``` class Song { impl as Combined { - fn Play[me: Self]() { ... } - fn Run[me: Self]() { ... } + fn Play[self: Self]() { ... } + fn Run[self: Self]() { ... } } } ``` @@ -1344,10 +1344,10 @@ This is equivalent to implementing the required interfaces directly: ``` class Song { impl as Media { - fn Play[me: Self]() { ... } + fn Play[self: Self]() { ... } } impl as Job { - fn Run[me: Self]() { ... } + fn Run[self: Self]() { ... } } } ``` @@ -1362,7 +1362,7 @@ Conversely, an `interface` can extend a `constraint`: interface MovieCodec { extends Combined; - fn Load[addr me: Self*](filename: String); + fn Load[addr self: Self*](filename: String); } ``` @@ -1376,7 +1376,7 @@ interface MovieCodec { impl as Job; alias Run = Job.Run; - fn Load[addr me: Self*](filename: String); + fn Load[addr self: Self*](filename: String); } ``` @@ -1387,19 +1387,19 @@ Consider this set of interfaces, simplified from ``` interface Graph { - fn Source[addr me: Self*](e: EdgeDescriptor) -> VertexDescriptor; - fn Target[addr me: Self*](e: EdgeDescriptor) -> VertexDescriptor; + fn Source[addr self: Self*](e: EdgeDescriptor) -> VertexDescriptor; + fn Target[addr self: Self*](e: EdgeDescriptor) -> VertexDescriptor; } interface IncidenceGraph { extends Graph; - fn OutEdges[addr me: Self*](u: VertexDescriptor) + fn OutEdges[addr self: Self*](u: VertexDescriptor) -> (EdgeIterator, EdgeIterator); } interface EdgeListGraph { extends Graph; - fn Edges[addr me: Self*]() -> (EdgeIterator, EdgeIterator); + fn Edges[addr self: Self*]() -> (EdgeIterator, EdgeIterator); } ``` @@ -1424,13 +1424,13 @@ though could be defined in the `impl` block of `IncidenceGraph`, ``` class MyEdgeListIncidenceGraph { impl as IncidenceGraph { - fn Source[me: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } - fn Target[me: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } - fn OutEdges[addr me: Self*](u: VertexDescriptor) + fn Source[self: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } + fn Target[self: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } + fn OutEdges[addr self: Self*](u: VertexDescriptor) -> (EdgeIterator, EdgeIterator) { ... } } impl as EdgeListGraph { - fn Edges[addr me: Self*]() -> (EdgeIterator, EdgeIterator) { ... } + fn Edges[addr self: Self*]() -> (EdgeIterator, EdgeIterator) { ... } } } ``` @@ -1441,13 +1441,13 @@ though could be defined in the `impl` block of `IncidenceGraph`, ``` class MyEdgeListIncidenceGraph { impl as IncidenceGraph { - fn Source[me: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } - fn OutEdges[addr me: Self*](u: VertexDescriptor) + fn Source[self: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } + fn OutEdges[addr self: Self*](u: VertexDescriptor) -> (EdgeIterator, EdgeIterator) { ... } } impl as EdgeListGraph { - fn Target[me: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } - fn Edges[addr me: Self*]() -> (EdgeIterator, EdgeIterator) { ... } + fn Target[self: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } + fn Edges[addr self: Self*]() -> (EdgeIterator, EdgeIterator) { ... } } } ``` @@ -1457,8 +1457,8 @@ though could be defined in the `impl` block of `IncidenceGraph`, ``` class MyEdgeListIncidenceGraph { impl as Graph { - fn Source[me: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } - fn Target[me: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } + fn Source[self: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } + fn Target[self: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } } impl as IncidenceGraph { ... } impl as EdgeListGraph { ... } @@ -1473,8 +1473,8 @@ though could be defined in the `impl` block of `IncidenceGraph`, impl as EdgeListGraph { ... } } external impl MyEdgeListIncidenceGraph as Graph { - fn Source[me: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } - fn Target[me: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } + fn Source[self: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } + fn Target[self: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } } ``` @@ -1496,17 +1496,17 @@ the capabilities of the iterator being passed in: ``` interface ForwardIntIterator { - fn Advance[addr me: Self*](); - fn Get[me: Self]() -> i32; + fn Advance[addr self: Self*](); + fn Get[self: Self]() -> i32; } interface BidirectionalIntIterator { extends ForwardIntIterator; - fn Back[addr me: Self*](); + fn Back[addr self: Self*](); } interface RandomAccessIntIterator { extends BidirectionalIntIterator; - fn Skip[addr me: Self*](offset: i32); - fn Difference[me: Self](rhs: Self) -> i32; + fn Skip[addr self: Self*](offset: i32); + fn Difference[self: Self](rhs: Self) -> i32; } fn SearchInSortedList[IterT:! ForwardIntIterator] @@ -1537,21 +1537,21 @@ APIs, in particular with different interface implementations, by ``` interface Printable { - fn Print[me: Self](); + fn Print[self: Self](); } interface Comparable { - fn Less[me: Self](rhs: Self) -> bool; + fn Less[self: Self](rhs: Self) -> bool; } class Song { - impl as Printable { fn Print[me: Self]() { ... } } + impl as Printable { fn Print[self: Self]() { ... } } } adapter SongByTitle for Song { impl as Comparable { - fn Less[me: Self](rhs: Self) -> bool { ... } + fn Less[self: Self](rhs: Self) -> bool { ... } } } adapter FormattedSong for Song { - impl as Printable { fn Print[me: Self]() { ... } } + impl as Printable { fn Print[self: Self]() { ... } } } adapter FormattedSongByTitle for Song { impl as Printable = FormattedSong; @@ -1581,8 +1581,8 @@ type may be accessed either by a cast: ``` adapter SongByTitle for Song { impl as Comparable { - fn Less[me: Self](rhs: Self) -> bool { - return (me as Song).Title() < (rhs as Song).Title(); + fn Less[self: Self](rhs: Self) -> bool { + return (self as Song).Title() < (rhs as Song).Title(); } } } @@ -1593,8 +1593,8 @@ or using a qualified member access expression: ``` adapter SongByTitle for Song { impl as Comparable { - fn Less[me: Self](rhs: Self) -> bool { - return me.(Song.Title)() < rhs.(Song.Title)(); + fn Less[self: Self](rhs: Self) -> bool { + return self.(Song.Title)() < rhs.(Song.Title)(); } } } @@ -1620,7 +1620,7 @@ Consider a type with a generic type parameter, like a hash map: ``` interface Hashable { ... } class HashMap(KeyT:! Hashable, ValueT:! Type) { - fn Find[me:Self](key: KeyT) -> Optional(ValueT); + fn Find[self: Self](key: KeyT) -> Optional(ValueT); // ... } ``` @@ -1706,7 +1706,7 @@ individually or renamed using `alias` declarations. ``` adapter SongRenderToPrintDriver extends Song { // Add a new `Print()` member function. - fn Print[me: Self]() { ... } + fn Print[self: Self]() { ... } // Avoid name conflict with new `Print` function by making // the implementation of the `Printable` interface external. @@ -1772,7 +1772,7 @@ smaller: ``` interface Comparable { - fn Less[me: Self](rhs: Self) -> bool; + fn Less[self: Self](rhs: Self) -> bool; } ``` @@ -1781,19 +1781,19 @@ another interface `Difference`: ``` interface Difference { - fn Sub[me:Self](rhs: Self) -> i32; + fn Sub[self: Self](rhs: Self) -> i32; } adapter ComparableFromDifference(T:! Difference) for T { impl as Comparable { - fn Less[me: Self](rhs: Self) -> bool { - return (me as T).Sub(rhs) < 0; + fn Less[self: Self](rhs: Self) -> bool { + return (self as T).Sub(rhs) < 0; } } } class IntWrapper { var x: i32; impl as Difference { - fn Sub[me: Self](rhs: Self) -> i32 { + fn Sub[self: Self](rhs: Self) -> i32 { return left.x - right.x; } } @@ -1808,8 +1808,8 @@ use to the adapter instead: adapter ComparableFromDifferenceFn (T:! Type, Difference:! fnty(T, T)->i32) for T { impl as Comparable { - fn Less[me: Self](rhs: Self) -> bool { - return Difference(me, rhs) < 0; + fn Less[self: Self](rhs: Self) -> bool { + return Difference(self, rhs) < 0; } } } @@ -1830,14 +1830,14 @@ to say that type implements an interface as a private detail internal to the implementation of the type. In that case, instead of implementing the interface for the public type, the library can create a private adapter for that type and implement the interface on that instead. Any member of the class can cast its -`me` parameter to the adapter type when it wants to make use of the private +`self` parameter to the adapter type when it wants to make use of the private impl. ``` // Public, in API file class Complex64 { // ... - fn CloserToOrigin[me: Self](them: Self) -> bool; + fn CloserToOrigin[self: Self](them: Self) -> bool; } // Private @@ -1847,14 +1847,14 @@ adapter ByReal extends Complex64 { // but this comparison function is useful for some // method implementations. impl as Comparable { - fn Less[me: Self](that: Self) -> bool { - return me.Real() < that.Real(); + fn Less[self: Self](that: Self) -> bool { + return self.Real() < that.Real(); } } } -fn Complex64.CloserToOrigin[me: Self](them: Self) -> bool { - var me_mag: ByReal = me * me.Conj() as ByReal; +fn Complex64.CloserToOrigin[self: Self](them: Self) -> bool { + var me_mag: ByReal = self * self.Conj() as ByReal; var them_mag: ByReal = them * them.Conj() as ByReal; return me_mag.Less(them_mag); } @@ -1867,10 +1867,10 @@ that is [implemented externally](terminology.md#external-impl) for a type. ``` interface DrawingContext { - fn SetPen[me: Self](...); - fn SetFill[me: Self](...); - fn DrawRectangle[me: Self](...); - fn DrawLine[me: Self](...); + fn SetPen[self: Self](...); + fn SetFill[self: Self](...); + fn DrawRectangle[self: Self](...); + fn DrawLine[self: Self](...); ... } external impl Window as DrawingContext { ... } @@ -1920,10 +1920,10 @@ associated constant. interface NSpacePoint { let N:! i32; // The following require: 0 <= i < N. - fn Get[addr me: Self*](i: i32) -> f64; - fn Set[addr me: Self*](i: i32, value: f64); + fn Get[addr self: Self*](i: i32) -> f64; + fn Set[addr self: Self*](i: i32, value: f64); // Associated constants may be used in signatures: - fn SetAll[addr me: Self*](value: Array(f64, N)); + fn SetAll[addr self: Self*](value: Array(f64, N)); } ``` @@ -1934,17 +1934,17 @@ a [`where` clause](#where-constraints). For example, implementations of ``` class Point2D { impl as NSpacePoint where .N = 2 { - fn Get[addr me: Self*](i: i32) -> f64 { ... } - fn Set[addr me: Self*](i: i32, value: f64) { ... } - fn SetAll[addr me: Self*](value: Array(f64, 2)) { ... } + fn Get[addr self: Self*](i: i32) -> f64 { ... } + fn Set[addr self: Self*](i: i32, value: f64) { ... } + fn SetAll[addr self: Self*](value: Array(f64, 2)) { ... } } } class Point3D { impl as NSpacePoint where .N = 3 { - fn Get[addr me: Self*](i: i32) -> f64 { ... } - fn Set[addr me: Self*](i: i32, value: f64) { ... } - fn SetAll[addr me: Self*](value: Array(f64, 3)) { ... } + fn Get[addr self: Self*](i: i32) -> f64 { ... } + fn Set[addr self: Self*](i: i32, value: f64) { ... } + fn SetAll[addr self: Self*](value: Array(f64, 3)) { ... } } } ``` @@ -2036,9 +2036,9 @@ name. For example: ``` interface StackAssociatedType { let ElementType:! Type; - fn Push[addr me: Self*](value: ElementType); - fn Pop[addr me: Self*]() -> ElementType; - fn IsEmpty[addr me: Self*]() -> bool; + fn Push[addr self: Self*](value: ElementType); + fn Pop[addr self: Self*]() -> ElementType; + fn IsEmpty[addr self: Self*]() -> bool; } ``` @@ -2051,26 +2051,26 @@ implements `StackAssociatedType`: ``` class DynamicArray(T:! Type) { class IteratorType { ... } - fn Begin[addr me: Self*]() -> IteratorType; - fn End[addr me: Self*]() -> IteratorType; - fn Insert[addr me: Self*](pos: IteratorType, value: T); - fn Remove[addr me: Self*](pos: IteratorType); + fn Begin[addr self: Self*]() -> IteratorType; + fn End[addr self: Self*]() -> IteratorType; + fn Insert[addr self: Self*](pos: IteratorType, value: T); + fn Remove[addr self: Self*](pos: IteratorType); // Set the associated type `ElementType` to `T`. impl as StackAssociatedType where .ElementType = T { - fn Push[addr me: Self*](value: ElementType) { - me->Insert(me->End(), value); + fn Push[addr self: Self*](value: ElementType) { + self->Insert(self->End(), value); } - fn Pop[addr me: Self*]() -> ElementType { - var pos: IteratorType = me->End(); - Assert(pos != me->Begin()); + fn Pop[addr self: Self*]() -> ElementType { + var pos: IteratorType = self->End(); + Assert(pos != self->Begin()); --pos; returned var ret: ElementType = *pos; - me->Remove(pos); + self->Remove(pos); return var; } - fn IsEmpty[addr me: Self*]() -> bool { - return me->Begin() == me->End(); + fn IsEmpty[addr self: Self*]() -> bool { + return self->Begin() == self->End(); } } } @@ -2149,12 +2149,12 @@ witness table. ``` interface Iterator { - fn Advance[addr me: Self*](); + fn Advance[addr self: Self*](); } interface Container { let IteratorType:! Iterator; - fn Begin[addr me: Self*]() -> IteratorType; + fn Begin[addr self: Self*]() -> IteratorType; } ``` @@ -2192,9 +2192,9 @@ of the associated type declaration: ``` interface StackParameterized(ElementType:! Type) { - fn Push[addr me: Self*](value: ElementType); - fn Pop[addr me: Self*]() -> ElementType; - fn IsEmpty[addr me: Self*]() -> bool; + fn Push[addr self: Self*](value: ElementType); + fn Pop[addr self: Self*]() -> ElementType; + fn IsEmpty[addr self: Self*]() -> bool; } ``` @@ -2206,25 +2206,25 @@ class Produce { var fruit: DynamicArray(Fruit); var veggie: DynamicArray(Veggie); impl as StackParameterized(Fruit) { - fn Push[addr me: Self*](value: Fruit) { - me->fruit.Push(value); + fn Push[addr self: Self*](value: Fruit) { + self->fruit.Push(value); } - fn Pop[addr me: Self*]() -> Fruit { - return me->fruit.Pop(); + fn Pop[addr self: Self*]() -> Fruit { + return self->fruit.Pop(); } - fn IsEmpty[addr me: Self*]() -> bool { - return me->fruit.IsEmpty(); + fn IsEmpty[addr self: Self*]() -> bool { + return self->fruit.IsEmpty(); } } impl as StackParameterized(Veggie) { - fn Push[addr me: Self*](value: Veggie) { - me->veggie.Push(value); + fn Push[addr self: Self*](value: Veggie) { + self->veggie.Push(value); } - fn Pop[addr me: Self*]() -> Veggie { - return me->veggie.Pop(); + fn Pop[addr self: Self*]() -> Veggie { + return self->veggie.Pop(); } - fn IsEmpty[addr me: Self*]() -> bool { - return me->veggie.IsEmpty(); + fn IsEmpty[addr self: Self*]() -> bool { + return self->veggie.IsEmpty(); } } } @@ -2272,7 +2272,7 @@ be comparable with multiple other types, and in fact interfaces for ``` interface EquatableWith(T:! Type) { - fn Equals[me: Self](rhs: T) -> bool; + fn Equals[self: Self](rhs: T) -> bool; ... } class Complex { @@ -2300,8 +2300,8 @@ could be an interface parameter: ``` interface ReadTupleMember(index:! u32) { let T:! Type; - // Returns me[index] - fn Get[me: Self]() -> T; + // Returns self[index] + fn Get[self: Self]() -> T; } ``` @@ -2313,7 +2313,7 @@ parameters are required to always be different. For example: ``` interface Map(FromType:! Type, ToType:! Type) { - fn Map[addr me: Self*](needle: FromType) -> Optional(ToType); + fn Map[addr self: Self*](needle: FromType) -> Optional(ToType); } class Bijection(FromType:! Type, ToType:! Type) { impl as Map(FromType, ToType) { ... } @@ -2405,7 +2405,7 @@ fn F[V:! D where ...](v: V) { ... } // Constraints on a class parameter: class S(T:! B where ...) { // Constraints on a method: - fn G[me: Self, V:! D where ...](v: V); + fn G[self: Self, V:! D where ...](v: V); } // Constraints on an interface parameter: @@ -2413,7 +2413,7 @@ interface A(T:! B where ...) { // Constraints on an associated type: let U:! C where ...; // Constraints on an associated method: - fn G[me: Self, V:! D where ...](v: V); + fn G[self: Self, V:! D where ...](v: V); } ``` @@ -2740,7 +2740,7 @@ to encode the return type: interface HasAbs { extends Numeric; let MagnitudeType:! Numeric; - fn Abs[me: Self]() -> MagnitudeType; + fn Abs[self: Self]() -> MagnitudeType; } ``` @@ -2783,7 +2783,7 @@ interface Container { where .ElementType == ElementType and .SliceType == .Self; - fn GetSlice[addr me: Self*] + fn GetSlice[addr self: Self*] (start: IteratorType, end: IteratorType) -> SliceType; } ``` @@ -2840,7 +2840,7 @@ from an integer type like `i32`: ``` interface As(T:! Type) { - fn Convert[me: Self]() -> T; + fn Convert[self: Self]() -> T; } fn Double[T:! Mul where i32 is As(.Self)](x: T) -> T { @@ -2911,7 +2911,7 @@ limited to a single signature. Consider this interface declaration: ``` interface GraphNode { let Edge:! Type; - fn EdgesFrom[me: Self]() -> HashSet(Edge); + fn EdgesFrom[self: Self]() -> HashSet(Edge); } ``` @@ -3000,17 +3000,17 @@ Given this interface `Transitive` that has associated types that are constrained to all be equal, with interfaces `P`, `Q`, and `R`: ``` -interface P { fn InP[me:Self](); } -interface Q { fn InQ[me:Self](); } -interface R { fn InR[me:Self](); } +interface P { fn InP[self: Self](); } +interface Q { fn InQ[self: Self](); } +interface R { fn InR[self: Self](); } interface Transitive { let A:! P; let B:! Q where .Self == A; let C:! R where .Self == B; - fn GetA[me: Self]() -> A; - fn TakesC[me:Self](c: C); + fn GetA[self: Self]() -> A; + fn TakesC[self: Self](c: C); } ``` @@ -3075,9 +3075,9 @@ interface Commute { let X:! Commute; let Y:! Commute where .X == X.Y; - fn GetX[me: Self]() -> X; - fn GetY[me: Self]() -> Y; - fn TakesXXY[me:Self](xxy: X.X.Y); + fn GetX[self: Self]() -> X; + fn GetY[self: Self]() -> Y; + fn TakesXXY[self: Self](xxy: X.X.Y); } ``` @@ -3172,17 +3172,17 @@ link between associated types `A` and `C` that allows function `F` to type check. ``` -interface P { fn InP[me:Self](); } -interface Q { fn InQ[me:Self](); } -interface R { fn InR[me:Self](); } +interface P { fn InP[self: Self](); } +interface Q { fn InQ[self: Self](); } +interface R { fn InR[self: Self](); } interface Transitive { let A:! P; let B:! Q where .Self == A; let C:! R where .Self == B; - fn GetA[me: Self]() -> A; - fn TakesC[me:Self](c: C); + fn GetA[self: Self]() -> A; + fn TakesC[self: Self](c: C); // Without this `observe` declaration, the // calls in `F` below would not be allowed. @@ -3300,7 +3300,7 @@ the same interface for a type. ``` enum CompareResult { Less, Equal, Greater } interface Comparable { - fn Compare[me: Self](rhs: Self) -> CompareResult; + fn Compare[self: Self](rhs: Self) -> CompareResult; } fn CombinedLess[T:! Type](a: T, b: T, U:! CompatibleWith(T) & Comparable, @@ -3360,9 +3360,9 @@ adapter ThenCompare( CompareList:! List(CompatibleWith(T) & Comparable)) for T { impl as Comparable { - fn Compare[me: Self](rhs: Self) -> CompareResult { + fn Compare[self: Self](rhs: Self) -> CompareResult { for (let U:! auto in CompareList) { - var result: CompareResult = (me as U).Compare(rhs as U); + var result: CompareResult = (self as U).Compare(rhs as U); if (result != CompareResult.Equal) { return result; } @@ -3656,15 +3656,15 @@ To do this with an [`external impl`](#external-impl), specify a more-specific ``` interface Printable { - fn Print[me: Self](); + fn Print[self: Self](); } class Vector(T:! Type) { ... } // By saying "T:! Printable" instead of "T:! Type" here, // we constrain T to be Printable for this impl. external impl forall [T:! Printable] Vector(T) as Printable { - fn Print[me: Self]() { - for (let a: T in me) { + fn Print[self: Self]() { + for (let a: T in self) { // Can call `Print` on `a` since the constraint // on `T` ensures it implements `Printable`. a.Print(); @@ -3719,11 +3719,11 @@ member name, even if their conditions are mutually exclusive: ``` class X(T:! Type) { impl X(i32) as Foo { - fn F[me: Self](); + fn F[self: Self](); } impl X(i64) as Bar { // ❌ Illegal: name conflict between `Foo.F` and `Bar.F` - fn F[me: Self](n: i64); + fn F[self: Self](n: i64); } } ``` @@ -3734,11 +3734,11 @@ is no overlap in the conditions: ``` class X(T:! Type) { impl X(i32) as Foo { - fn F[me: Self](); + fn F[self: Self](); } impl X(i64) as Foo { // ✅ Allowed: `X(T).F` consistently means `X(T).(Foo.F)` - fn F[me: Self](); + fn F[self: Self](); } } ``` @@ -3763,7 +3763,7 @@ a vector type that only has a `Sort` method if its elements implement the ``` class Vector(T:! Type) { // `Vector(T)` has a `Sort()` method if `T` is `Comparable`. - fn Sort[C:! Comparable, addr me: Vector(C)*](); + fn Sort[C:! Comparable, addr self: Vector(C)*](); } ``` @@ -4142,20 +4142,20 @@ generic function call, such as using an operator: // Interface defining the behavior of the prefix-* operator interface Deref { let Result:! Type; - fn DoDeref[me: Self]() -> Result; + fn DoDeref[self: Self]() -> Result; } // Types implementing `Deref` class Ptr(T:! Type) { ... external impl as Deref where .Result = T { - fn DoDeref[me: Self]() -> Result { ... } + fn DoDeref[self: Self]() -> Result { ... } } } class Optional(T:! Type) { ... external impl as Deref where .Result = T { - fn DoDeref[me: Self]() -> Result { ... } + fn DoDeref[self: Self]() -> Result { ... } } } @@ -4185,14 +4185,14 @@ class Ptr(T:! Type) { ... // Note: added `final` final external impl as Deref where .Result = T { - fn DoDeref[me: Self]() -> Result { ... } + fn DoDeref[self: Self]() -> Result { ... } } } class Optional(T:! Type) { ... // Note: added `final` final external impl as Deref where .Result = T { - fn DoDeref[me: Self]() -> Result { ... } + fn DoDeref[self: Self]() -> Result { ... } } } @@ -4547,11 +4547,11 @@ private constraint NodeFor(E:! Edge); // Define interfaces using named constraints. interface Edge { let NodeType:! NodeFor(Self); - fn Head[me: Self]() -> NodeType; + fn Head[self: Self]() -> NodeType; } interface Node { let EdgeType:! EdgeFor(Self); - fn Edges[me: Self]() -> Vector(EdgeType); + fn Edges[self: Self]() -> Vector(EdgeType); } // Now that the interfaces are defined, can @@ -4626,11 +4626,11 @@ methods in the interface. ``` interface Vector { - fn Add[me: Self](b: Self) -> Self; - fn Scale[me: Self](v: f64) -> Self; + fn Add[self: Self](b: Self) -> Self; + fn Scale[self: Self](v: f64) -> Self; // Default definition of `Invert` calls `Scale`. - default fn Invert[me: Self]() -> Self { - return me.Scale(-1.0); + default fn Invert[self: Self]() -> Self { + return self.Scale(-1.0); } } ``` @@ -4640,14 +4640,14 @@ file as the interface definition: ``` interface Vector { - fn Add[me: Self](b: Self) -> Self; - fn Scale[me: Self](v: f64) -> Self; - default fn Invert[me: Self]() -> Self; + fn Add[self: Self](b: Self) -> Self; + fn Scale[self: Self](v: f64) -> Self; + default fn Invert[self: Self]() -> Self; } // `Vector` is considered complete at this point, // even though `Vector.Invert` is still incomplete. -fn Vector.Invert[me: Self]() -> Self { - return me.Scale(-1.0); +fn Vector.Invert[self: Self]() -> Self { + return self.Scale(-1.0); } ``` @@ -4667,12 +4667,12 @@ types, and interface parameters, using the `= ` syntax. ``` interface Add(Right:! Type = Self) { default let Result:! Type = Self; - fn DoAdd[me: Self](right: Right) -> Result; + fn DoAdd[self: Self](right: Right) -> Result; } impl String as Add() { // Right == Result == Self == String - fn DoAdd[me: Self](right: Self) -> Self; + fn DoAdd[self: Self](right: Self) -> Self; } ``` @@ -4705,12 +4705,12 @@ interface. ``` interface TotalOrder { - fn TotalLess[me: Self](right: Self) -> bool; + fn TotalLess[self: Self](right: Self) -> bool; // ❌ Illegal: May not provide definition // for required interface. impl as PartialOrder { - fn PartialLess[me: Self](right: Self) -> bool { - return me.TotalLess(right); + fn PartialLess[self: Self](right: Self) -> bool { + return self.TotalLess(right); } } } @@ -4721,13 +4721,13 @@ instead: ``` interface TotalOrder { - fn TotalLess[me: Self](right: Self) -> bool; + fn TotalLess[self: Self](right: Self) -> bool; impl as PartialOrder; } external impl forall [T:! TotalOrder] T as PartialOrder { - fn PartialLess[me: Self](right: Self) -> bool { - return me.TotalLess(right); + fn PartialLess[self: Self](right: Self) -> bool { + return self.TotalLess(right); } } ``` @@ -4750,18 +4750,18 @@ overridden in impls. ``` interface TotalOrder { - fn TotalLess[me: Self](right: Self) -> bool; - final fn TotalGreater[me: Self](right: Self) -> bool { - return right.TotalLess(me); + fn TotalLess[self: Self](right: Self) -> bool; + final fn TotalGreater[self: Self](right: Self) -> bool { + return right.TotalLess(self); } } class String { impl as TotalOrder { - fn TotalLess[me: Self](right: Self) -> bool { ... } + fn TotalLess[self: Self](right: Self) -> bool { ... } // ❌ Illegal: May not provide definition of final // method `TotalGreater`. - fn TotalGreater[me: Self](right: Self) -> bool { ... } + fn TotalGreater[self: Self](right: Self) -> bool { ... } } } @@ -4770,7 +4770,7 @@ interface Add(T:! Type = Self) { final let AddWith:! Type = T; // Has a *default* of `Self` let Result:! Type = Self; - fn DoAdd[me: Self](right: AddWith) -> Result; + fn DoAdd[self: Self](right: AddWith) -> Result; } ``` @@ -4778,13 +4778,13 @@ Final members may also be defined out-of-line: ``` interface TotalOrder { - fn TotalLess[me: Self](right: Self) -> bool; - final fn TotalGreater[me: Self](right: Self) -> bool; + fn TotalLess[self: Self](right: Self) -> bool; + final fn TotalGreater[self: Self](right: Self) -> bool; } // `TotalOrder` is considered complete at this point, even // though `TotalOrder.TotalGreater` is not yet defined. -fn TotalOrder.TotalGreater[me: Self](right: Self) -> bool { - return right.TotalLess(me); +fn TotalOrder.TotalGreater[self: Self](right: Self) -> bool { + return right.TotalLess(self); } ``` @@ -5041,7 +5041,7 @@ interface to overload the unary `-` operator: // Unary `-`. interface Negatable { let Result:! Type = Self; - fn Negate[me: Self]() -> Result; + fn Negate[self: Self]() -> Result; } ``` @@ -5063,7 +5063,7 @@ expression, implement the ``` interface As(Dest:! Type) { - fn Convert[me: Self]() -> Dest; + fn Convert[self: Self]() -> Dest; } ``` @@ -5079,7 +5079,7 @@ for a binary operator like `*`: // Binary `*`. interface MultipliableWith(U:! Type) { let Result:! Type = Self; - fn Multiply[me: Self](other: U) -> Result; + fn Multiply[self: Self](other: U) -> Result; } ``` @@ -5102,14 +5102,14 @@ second implementation from the first, as in: ``` interface ComparableWith(RHS:! Type) { - fn Compare[me: Self](right: RHS) -> CompareResult; + fn Compare[self: Self](right: RHS) -> CompareResult; } adapter ReverseComparison (T:! Type, U:! ComparableWith(RHS)) for T { impl as ComparableWith(U) { - fn Compare[me: Self](right: RHS) -> CompareResult { - return ReverseCompareResult(right.Compare(me)); + fn Compare[self: Self](right: RHS) -> CompareResult { + return ReverseCompareResult(right.Compare(self)); } } } @@ -5129,7 +5129,7 @@ an interface that the other implements: ``` interface IntLike { - fn AsInt[me: Self]() -> i64; + fn AsInt[self: Self]() -> i64; } class EvenInt { ... } @@ -5170,13 +5170,13 @@ multiplying by a value of type `f64`: ``` class Meters { - fn Scale[me: Self](s: f64) -> Self; + fn Scale[self: Self](s: f64) -> Self; } // "Implementation One" external impl Meters as MultipliableWith(f64) where .Result = Meters { - fn Multiply[me: Self](other: f64) -> Result { - return me.Scale(other); + fn Multiply[self: Self](other: f64) -> Result { + return self.Scale(other); } } ``` @@ -5204,10 +5204,10 @@ conversion. The implementation is for types that implement the // "Implementation Two" external impl forall [T:! ImplicitAs(f64)] Meters as MultipliableWith(T) where .Result = Meters { - fn Multiply[me: Self](other: T) -> Result { + fn Multiply[self: Self](other: T) -> Result { // Carbon will implicitly convert `other` from type // `T` to `f64` to perform this call. - return me.(Meters.(MultipliableWith(f64).Multiply))(other); + return self.(Meters.(MultipliableWith(f64).Multiply))(other); } } // ✅ Allowed: uses `Meters as MultipliableWith(T)` impl @@ -5228,8 +5228,8 @@ of a forward declaration or definition, in a place of a type. // compared to "implementation one" above. external impl Meters as MultipliableWith(like f64) where .Result = Meters { - fn Multiply[me: Self](other: f64) -> Result { - return me.Scale(other); + fn Multiply[self: Self](other: f64) -> Result { + return self.Scale(other); } } ``` @@ -5251,8 +5251,8 @@ In this example, there are two uses of `like`, producing three implementations ``` external impl like Meters as MultipliableWith(like f64) where .Result = Meters { - fn Multiply[me: Self](other: f64) -> Result { - return me.Scale(other); + fn Multiply[self: Self](other: f64) -> Result { + return self.Scale(other); } } ``` @@ -5262,10 +5262,10 @@ is equivalent to "implementation one", "implementation two", and: ``` external impl forall [T:! ImplicitAs(Meters)] T as MultipliableWith(f64) where .Result = Meters { - fn Multiply[me: Self](other: f64) -> Result { - // Will implicitly convert `me` to `Meters` in order to + fn Multiply[self: Self](other: f64) -> Result { + // Will implicitly convert `self` to `Meters` in order to // match the signature of this `Multiply` method. - return me.(Meters.(MultipliableWith(f64).Multiply))(other); + return self.(Meters.(MultipliableWith(f64).Multiply))(other); } } ``` @@ -5332,7 +5332,7 @@ there is one from `Vector(T)` to `Vector(String)`, so the following use of ``` // ❌ Illegal: Can't convert a value with type // `Vector(T:! ImplicitAs(String))` -// to `Vector(String)` for `me` +// to `Vector(String)` for `self` // parameter of `Printable.Print`. external impl Vector(like String) as Printable; ``` @@ -5388,7 +5388,7 @@ class HashMap( // `Self` is `HashMap(KeyType, ValueType)`. // Parameters may be used in function signatures. - fn Insert[addr me: Self*](k: KeyType, v: ValueType); + fn Insert[addr self: Self*](k: KeyType, v: ValueType); // Parameters may be used in field types. private var buckets: Vector((KeyType, ValueType)); diff --git a/docs/design/generics/overview.md b/docs/design/generics/overview.md index 2f6810f8bee90..fda949b55c9e9 100644 --- a/docs/design/generics/overview.md +++ b/docs/design/generics/overview.md @@ -159,7 +159,7 @@ Example: ``` interface Comparable { // `Less` is an associated method. - fn Less[me: Self](rhs: Self) -> Bool; + fn Less[self: Self](rhs: Self) -> Bool; } ``` @@ -192,7 +192,7 @@ Consider this interface: ``` interface Printable { - fn Print[me: Self](); + fn Print[self: Self](); } ``` @@ -209,7 +209,7 @@ class Song { // as `F`, are included as a part of the `Song` API. impl as Printable { // Could use `Self` in place of `Song` here. - fn Print[me: Song]() { ... } + fn Print[self: Song]() { ... } } } @@ -218,7 +218,7 @@ class Song { // the library defining `Song` or `Comparable`. external impl Song as Comparable { // Could use either `Self` or `Song` here. - fn Less[me: Self](rhs: Self) -> Bool { ... } + fn Less[self: Self](rhs: Self) -> Bool { ... } } ``` @@ -350,13 +350,13 @@ Interfaces can require other interfaces be implemented: ``` interface Equatable { - fn IsEqual[me: Self](rhs: Self) -> Bool; + fn IsEqual[self: Self](rhs: Self) -> Bool; } // `Iterable` requires that `Equatable` is implemented. interface Iterable { impl as Equatable; - fn Advance[addr me: Self*](); + fn Advance[addr self: Self*](); } ``` @@ -369,13 +369,13 @@ interface. // `Hashable` extends `Equatable`. interface Hashable { extends Equatable; - fn Hash[me: Self]() -> u64; + fn Hash[self: Self]() -> u64; } // `Hashable` is equivalent to: interface Hashable { impl as Equatable; alias IsEqual = Equatable.IsEqual; - fn Hash[me: Self]() -> u64; + fn Hash[self: Self]() -> u64; } ``` @@ -386,8 +386,8 @@ methods in the implementation of the derived interface. class Key { // ... impl as Hashable { - fn IsEqual[me: Key](rhs: Key) -> Bool { ... } - fn Hash[me: Key]() -> u64 { ... } + fn IsEqual[self: Key](rhs: Key) -> Bool { ... } + fn Hash[self: Key]() -> u64 { ... } } // No need to separately implement `Equatable`. } @@ -403,14 +403,14 @@ It gives you all the names that don't conflict. ``` interface Renderable { - fn GetCenter[me: Self]() -> (i32, i32); + fn GetCenter[self: Self]() -> (i32, i32); // Draw the object to the screen - fn Draw[me: Self](); + fn Draw[self: Self](); } interface EndOfGame { - fn SetWinner[addr me: Self*](player: i32); + fn SetWinner[addr self: Self*](player: i32); // Indicate the game was a draw - fn Draw[addr me: Self*](); + fn Draw[addr self: Self*](); } fn F[T:! Renderable & EndOfGame](game_state: T*) -> (i32, i32) { @@ -533,9 +533,9 @@ element types: ``` interface Stack { let ElementType:! Movable; - fn Push[addr me: Self*](value: ElementType); - fn Pop[addr me: Self*]() -> ElementType; - fn IsEmpty[addr me: Self*]() -> Bool; + fn Push[addr self: Self*](value: ElementType); + fn Pop[addr self: Self*]() -> ElementType; + fn IsEmpty[addr self: Self*]() -> Bool; } ``` @@ -561,7 +561,7 @@ those types to be different. An element in a hash map might have type ``` interface Equatable(T:! Type) { - fn IsEqual[me: Self](compare_to: T) -> Bool; + fn IsEqual[self: Self](compare_to: T) -> Bool; } ``` diff --git a/docs/design/generics/terminology.md b/docs/design/generics/terminology.md index 33d9ad7a41c9b..5579e335b9118 100644 --- a/docs/design/generics/terminology.md +++ b/docs/design/generics/terminology.md @@ -648,8 +648,8 @@ Interface type parameter example: ``` interface StackTP(ElementType:! Type) - fn Push[addr me: Self*](value: ElementType); - fn Pop[addr me: Self*]() -> ElementType; + fn Push[addr self: Self*](value: ElementType); + fn Pop[addr self: Self*]() -> ElementType; } ``` @@ -658,8 +658,8 @@ Associated type example: ``` interface StackAT { let ElementType:! Type; - fn Push[addr me: Self*](value: ElementType); - fn Pop[addr me: Self*]() -> ElementType; + fn Push[addr self: Self*](value: ElementType); + fn Pop[addr self: Self*]() -> ElementType; } ``` @@ -675,7 +675,7 @@ interface Container { // since this type is determined from the container type. let IteratorType:! Iterator; ... - fn Insert[addr me: Self*](position: IteratorType, value: ElementType); + fn Insert[addr self: Self*](position: IteratorType, value: ElementType); } class ListIterator(ElementType:! Type) { ... @@ -684,7 +684,7 @@ class ListIterator(ElementType:! Type) { class List(ElementType:! Type) { // Iterator type is determined by the container type. impl as Container where .IteratorType = ListIterator(ElementType) { - fn Insert[addr me: Self*](position: IteratorType, value: ElementType) { + fn Insert[addr self: Self*](position: IteratorType, value: ElementType) { ... } } @@ -703,7 +703,7 @@ another type: ``` interface Addable(T:! Type) { let ResultType:! Type; - fn Add[me: Self](rhs: T) -> ResultType; + fn Add[self: Self](rhs: T) -> ResultType; } ``` diff --git a/docs/design/templates.md b/docs/design/templates.md index 7377e68ed4941..013eef15c7a55 100644 --- a/docs/design/templates.md +++ b/docs/design/templates.md @@ -47,8 +47,8 @@ bound early to the extent possible. For example: class Stack(template T:! Type) { var storage: Array(T); - fn Push[addr me: Self*](value: T); - fn Pop[addr me: Self*]() -> T; + fn Push[addr self: Self*](value: T); + fn Pop[addr self: Self*]() -> T; } ``` diff --git a/explorer/ast/declaration.cpp b/explorer/ast/declaration.cpp index a52dccaaa077d..5af69d310f1aa 100644 --- a/explorer/ast/declaration.cpp +++ b/explorer/ast/declaration.cpp @@ -189,14 +189,14 @@ void ReturnTerm::Print(llvm::raw_ostream& out) const { auto FunctionDeclaration::Create(Nonnull arena, SourceLocation source_loc, std::string name, std::vector> deduced_params, - std::optional> me_pattern, + std::optional> self_pattern, Nonnull param_pattern, ReturnTerm return_term, std::optional> body) -> ErrorOr> { std::vector> resolved_params; - // Look for the `me` parameter in the `deduced_parameters` - // and put it in the `me_pattern`. + // Look for the `self` parameter in the `deduced_parameters` + // and put it in the `self_pattern`. for (Nonnull param : deduced_params) { switch (param->kind()) { case AstNodeKind::GenericBinding: @@ -204,21 +204,21 @@ auto FunctionDeclaration::Create(Nonnull arena, break; case AstNodeKind::BindingPattern: { Nonnull bp = &cast(*param); - if (me_pattern.has_value() || bp->name() != "me") { + if (self_pattern.has_value() || bp->name() != "self") { return CompilationError(source_loc) << "illegal binding pattern in implicit parameter list"; } - me_pattern = bp; + self_pattern = bp; break; } case AstNodeKind::AddrPattern: { Nonnull abp = &cast(*param); Nonnull bp = &cast(abp->binding()); - if (me_pattern.has_value() || bp->name() != "me") { + if (self_pattern.has_value() || bp->name() != "self") { return CompilationError(source_loc) << "illegal binding pattern in implicit parameter list"; } - me_pattern = abp; + self_pattern = abp; break; } default: @@ -226,9 +226,9 @@ auto FunctionDeclaration::Create(Nonnull arena, << "illegal AST node in implicit parameter list"; } } - return arena->New(source_loc, name, - std::move(resolved_params), me_pattern, - param_pattern, return_term, body); + return arena->New( + source_loc, name, std::move(resolved_params), self_pattern, param_pattern, + return_term, body); } void FunctionDeclaration::PrintDepth(int depth, llvm::raw_ostream& out) const { diff --git a/explorer/ast/declaration.h b/explorer/ast/declaration.h index 3daebee2c5056..d71e39d5b6565 100644 --- a/explorer/ast/declaration.h +++ b/explorer/ast/declaration.h @@ -107,7 +107,7 @@ class FunctionDeclaration : public Declaration { static auto Create(Nonnull arena, SourceLocation source_loc, std::string name, std::vector> deduced_params, - std::optional> me_pattern, + std::optional> self_pattern, Nonnull param_pattern, ReturnTerm return_term, std::optional> body) @@ -116,14 +116,14 @@ class FunctionDeclaration : public Declaration { // Use `Create()` instead. This is public only so Arena::New() can call it. FunctionDeclaration(SourceLocation source_loc, std::string name, std::vector> deduced_params, - std::optional> me_pattern, + std::optional> self_pattern, Nonnull param_pattern, ReturnTerm return_term, std::optional> body) : Declaration(AstNodeKind::FunctionDeclaration, source_loc), name_(std::move(name)), deduced_parameters_(std::move(deduced_params)), - me_pattern_(me_pattern), + me_pattern_(self_pattern), param_pattern_(param_pattern), return_term_(return_term), body_(body) {} @@ -142,8 +142,8 @@ class FunctionDeclaration : public Declaration { auto deduced_parameters() -> llvm::ArrayRef> { return deduced_parameters_; } - auto me_pattern() const -> const Pattern& { return **me_pattern_; } - auto me_pattern() -> Pattern& { return **me_pattern_; } + auto self_pattern() const -> const Pattern& { return **me_pattern_; } + auto self_pattern() -> Pattern& { return **me_pattern_; } auto param_pattern() const -> const TuplePattern& { return *param_pattern_; } auto param_pattern() -> TuplePattern& { return *param_pattern_; } auto return_term() const -> const ReturnTerm& { return return_term_; } diff --git a/explorer/ast/expression.h b/explorer/ast/expression.h index f454948b32620..2e6fb2147dff5 100644 --- a/explorer/ast/expression.h +++ b/explorer/ast/expression.h @@ -221,7 +221,7 @@ class SimpleMemberAccessExpression : public Expression { member_ = member; } - // Returns true if the field is a method that has a "me" declaration in an + // Returns true if the field is a method that has a "self" declaration in an // AddrPattern. auto is_field_addr_me_method() const -> bool { return is_field_addr_me_method_; diff --git a/explorer/data/prelude.carbon b/explorer/data/prelude.carbon index 9c5112c379f6e..6775c4096d1db 100644 --- a/explorer/data/prelude.carbon +++ b/explorer/data/prelude.carbon @@ -6,30 +6,30 @@ package Carbon api; // Implicitly convert `Self` to `T`. interface ImplicitAs(T:! Type) { - fn Convert[me: Self]() -> T; + fn Convert[self: Self]() -> T; } // TODO: Simplify this once we have variadics. // TODO: Should these be final? impl forall [U1:! Type, T1:! ImplicitAs(U1)] (T1,) as ImplicitAs((U1,)) { - fn Convert[me: Self]() -> (U1,) { - let (v1: T1,) = me; + fn Convert[self: Self]() -> (U1,) { + let (v1: T1,) = self; return (v1.Convert(),); } } impl forall [U1:! Type, U2:! Type, T1:! ImplicitAs(U1), T2:! ImplicitAs(U2)] (T1, T2) as ImplicitAs((U1, U2)) { - fn Convert[me: Self]() -> (U1, U2) { - let (v1: T1, v2: T2) = me; + fn Convert[self: Self]() -> (U1, U2) { + let (v1: T1, v2: T2) = self; return (v1.Convert(), v2.Convert()); } } impl forall [U1:! Type, U2:! Type, U3:! Type, T1:! ImplicitAs(U1), T2:! ImplicitAs(U2), T3:! ImplicitAs(U3)] (T1, T2, T3) as ImplicitAs((U1, U2, U3)) { - fn Convert[me: Self]() -> (U1, U2, U3) { - let (v1: T1, v2: T2, v3: T3) = me; + fn Convert[self: Self]() -> (U1, U2, U3) { + let (v1: T1, v2: T2, v3: T3) = self; return (v1.Convert(), v2.Convert(), v3.Convert()); } } @@ -41,10 +41,10 @@ fn Print(format_str: String) { } class Heap { - fn New[T:! Type, me: Self](x : T) -> T* { + fn New[T:! Type, self: Self](x : T) -> T* { return __intrinsic_new(x); } - fn Delete[T:! Type, me: Self](p : T*) { + fn Delete[T:! Type, self: Self](p : T*) { __intrinsic_delete(p); } } diff --git a/explorer/fuzzing/ast_to_proto.cpp b/explorer/fuzzing/ast_to_proto.cpp index ee301fc2fd02b..ae836ae0f7c8e 100644 --- a/explorer/fuzzing/ast_to_proto.cpp +++ b/explorer/fuzzing/ast_to_proto.cpp @@ -541,21 +541,22 @@ static auto DeclarationToProto(const Declaration& declaration) GenericBindingToProto(*binding); } if (function.is_method()) { - switch (function.me_pattern().kind()) { + switch (function.self_pattern().kind()) { case PatternKind::AddrPattern: *function_proto->mutable_me_pattern() = - PatternToProto(cast(function.me_pattern())); + PatternToProto(cast(function.self_pattern())); break; case PatternKind::BindingPattern: *function_proto->mutable_me_pattern() = - PatternToProto(cast(function.me_pattern())); + PatternToProto(cast(function.self_pattern())); break; default: - // Parser shouldn't allow me_pattern to be anything other than + // Parser shouldn't allow self_pattern to be anything other than // AddrPattern or BindingPattern - CARBON_FATAL() << "me_pattern in method declaration can be either " - "AddrPattern or BindingPattern. Actual pattern: " - << function.me_pattern(); + CARBON_FATAL() + << "self_pattern in method declaration can be either " + "AddrPattern or BindingPattern. Actual pattern: " + << function.self_pattern(); break; } } diff --git a/explorer/fuzzing/fuzzer_corpus/5a5e0f23676f5b95ddb2d0101131f22c1fc5515c b/explorer/fuzzing/fuzzer_corpus/01470906214372a9d64519f51bc84e89760838fc similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/5a5e0f23676f5b95ddb2d0101131f22c1fc5515c rename to explorer/fuzzing/fuzzer_corpus/01470906214372a9d64519f51bc84e89760838fc index a42c4ab1be1f1..af114eaedf531 100644 --- a/explorer/fuzzing/fuzzer_corpus/5a5e0f23676f5b95ddb2d0101131f22c1fc5515c +++ b/explorer/fuzzing/fuzzer_corpus/01470906214372a9d64519f51bc84e89760838fc @@ -24,9 +24,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -162,9 +162,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -205,7 +205,7 @@ compilation_unit { op: Add arguments { identifier { - name: "me" + name: "self" } } arguments { @@ -318,9 +318,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -373,7 +373,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -409,7 +409,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/f986b7976441ebd0928d8f4d13c6ff2be6a05f50 b/explorer/fuzzing/fuzzer_corpus/080504266a82cac1647fe47577ec3d03fc8f1e0b similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/f986b7976441ebd0928d8f4d13c6ff2be6a05f50 rename to explorer/fuzzing/fuzzer_corpus/080504266a82cac1647fe47577ec3d03fc8f1e0b index 9c474643a6a14..06587393769e1 100644 --- a/explorer/fuzzing/fuzzer_corpus/f986b7976441ebd0928d8f4d13c6ff2be6a05f50 +++ b/explorer/fuzzing/fuzzer_corpus/080504266a82cac1647fe47577ec3d03fc8f1e0b @@ -9,9 +9,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -52,9 +52,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -149,9 +149,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -202,7 +202,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -230,7 +230,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } @@ -258,9 +258,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -310,7 +310,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -333,7 +333,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/d829468ac733b7dd5677070c722c3c7ecd34c496 b/explorer/fuzzing/fuzzer_corpus/10262aa9c545ac25ae1cd7ccd0cdd7ad758ad1d8 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/d829468ac733b7dd5677070c722c3c7ecd34c496 rename to explorer/fuzzing/fuzzer_corpus/10262aa9c545ac25ae1cd7ccd0cdd7ad758ad1d8 index 76186b2cb5047..926b69819fdca 100644 --- a/explorer/fuzzing/fuzzer_corpus/d829468ac733b7dd5677070c722c3c7ecd34c496 +++ b/explorer/fuzzing/fuzzer_corpus/10262aa9c545ac25ae1cd7ccd0cdd7ad758ad1d8 @@ -9,9 +9,9 @@ compilation_unit { members { function { name: "F" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -62,9 +62,9 @@ compilation_unit { members { function { name: "F" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { diff --git a/explorer/fuzzing/fuzzer_corpus/9a79849f37e616453382dcd0ff273c080d3b4f7f b/explorer/fuzzing/fuzzer_corpus/1b44103acf7ff5b98059b6ad83dfa87af4c820ca similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/9a79849f37e616453382dcd0ff273c080d3b4f7f rename to explorer/fuzzing/fuzzer_corpus/1b44103acf7ff5b98059b6ad83dfa87af4c820ca index 2cdbe10db4a30..93f8c68dbebe6 100644 --- a/explorer/fuzzing/fuzzer_corpus/9a79849f37e616453382dcd0ff273c080d3b4f7f +++ b/explorer/fuzzing/fuzzer_corpus/1b44103acf7ff5b98059b6ad83dfa87af4c820ca @@ -24,9 +24,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -162,9 +162,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -205,7 +205,7 @@ compilation_unit { op: Add arguments { identifier { - name: "me" + name: "self" } } arguments { @@ -331,9 +331,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -425,7 +425,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -461,7 +461,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/72624c04b293dcee7ecc0129b6e196195ca84332 b/explorer/fuzzing/fuzzer_corpus/1dd799e27118a9b31c58732b5536bb969d5dec47 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/72624c04b293dcee7ecc0129b6e196195ca84332 rename to explorer/fuzzing/fuzzer_corpus/1dd799e27118a9b31c58732b5536bb969d5dec47 index d475e844bb21e..a211fc7f862b6 100644 --- a/explorer/fuzzing/fuzzer_corpus/72624c04b293dcee7ecc0129b6e196195ca84332 +++ b/explorer/fuzzing/fuzzer_corpus/1dd799e27118a9b31c58732b5536bb969d5dec47 @@ -24,9 +24,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -242,9 +242,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -285,7 +285,7 @@ compilation_unit { op: Add arguments { identifier { - name: "me" + name: "self" } } arguments { diff --git a/explorer/fuzzing/fuzzer_corpus/cc53603327b15d1ec403cb0d83a7b65e388baa10 b/explorer/fuzzing/fuzzer_corpus/1ed6b0aaabbdb804a00c5f9de15e87bcea7b2989 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/cc53603327b15d1ec403cb0d83a7b65e388baa10 rename to explorer/fuzzing/fuzzer_corpus/1ed6b0aaabbdb804a00c5f9de15e87bcea7b2989 index bf13c0c33a9d4..12e6cb005bf14 100644 --- a/explorer/fuzzing/fuzzer_corpus/cc53603327b15d1ec403cb0d83a7b65e388baa10 +++ b/explorer/fuzzing/fuzzer_corpus/1ed6b0aaabbdb804a00c5f9de15e87bcea7b2989 @@ -9,9 +9,9 @@ compilation_unit { members { function { name: "F" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -77,9 +77,9 @@ compilation_unit { members { function { name: "F" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -130,7 +130,7 @@ compilation_unit { field: "n" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/c9bb494385213d19905103032c24c394b4c1a363 b/explorer/fuzzing/fuzzer_corpus/1feb91d5bdcaaa895ac4bdc8144dae56a77af690 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/c9bb494385213d19905103032c24c394b4c1a363 rename to explorer/fuzzing/fuzzer_corpus/1feb91d5bdcaaa895ac4bdc8144dae56a77af690 index 03696a41cc9ce..7a8c8463ff30d 100644 --- a/explorer/fuzzing/fuzzer_corpus/c9bb494385213d19905103032c24c394b4c1a363 +++ b/explorer/fuzzing/fuzzer_corpus/1feb91d5bdcaaa895ac4bdc8144dae56a77af690 @@ -9,9 +9,9 @@ compilation_unit { members { function { name: "F" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -62,7 +62,7 @@ compilation_unit { field: "n" object { identifier { - name: "me" + name: "self" } } } @@ -151,9 +151,9 @@ compilation_unit { members { function { name: "Convert" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -187,7 +187,7 @@ compilation_unit { field: "m" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/2caf42dcf02bff184fa653bf36054b9d83704e30 b/explorer/fuzzing/fuzzer_corpus/21fb9b4ef5f3cb228ced87f428683058b6ec9d0f similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/2caf42dcf02bff184fa653bf36054b9d83704e30 rename to explorer/fuzzing/fuzzer_corpus/21fb9b4ef5f3cb228ced87f428683058b6ec9d0f index 2c7b0163df846..e2b21ceee237f 100644 --- a/explorer/fuzzing/fuzzer_corpus/2caf42dcf02bff184fa653bf36054b9d83704e30 +++ b/explorer/fuzzing/fuzzer_corpus/21fb9b4ef5f3cb228ced87f428683058b6ec9d0f @@ -9,9 +9,9 @@ compilation_unit { members { function { name: "Op" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -122,9 +122,9 @@ compilation_unit { members { function { name: "Op" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -175,7 +175,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -203,7 +203,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/6f589265e1e503d2e01043d6a332026d1693095e b/explorer/fuzzing/fuzzer_corpus/23acc22cb4275aa5e0e8709621fc88d7c780ea62 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/6f589265e1e503d2e01043d6a332026d1693095e rename to explorer/fuzzing/fuzzer_corpus/23acc22cb4275aa5e0e8709621fc88d7c780ea62 index d8c3f5bd4f70d..d080b5c3f4851 100644 --- a/explorer/fuzzing/fuzzer_corpus/6f589265e1e503d2e01043d6a332026d1693095e +++ b/explorer/fuzzing/fuzzer_corpus/23acc22cb4275aa5e0e8709621fc88d7c780ea62 @@ -24,9 +24,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -67,9 +67,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -205,9 +205,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -258,7 +258,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -286,7 +286,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } @@ -314,9 +314,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -366,7 +366,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -389,7 +389,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/538556cd683ca838d1ffefb154cda7a804b3eafe b/explorer/fuzzing/fuzzer_corpus/2b19e350556fbbc1d4821da650b3cf0d17148ae9 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/538556cd683ca838d1ffefb154cda7a804b3eafe rename to explorer/fuzzing/fuzzer_corpus/2b19e350556fbbc1d4821da650b3cf0d17148ae9 index 3f4dec606dc77..18c712b83b545 100644 --- a/explorer/fuzzing/fuzzer_corpus/538556cd683ca838d1ffefb154cda7a804b3eafe +++ b/explorer/fuzzing/fuzzer_corpus/2b19e350556fbbc1d4821da650b3cf0d17148ae9 @@ -77,9 +77,9 @@ compilation_unit { members { function { name: "GetX" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -109,7 +109,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/87081db4d0965def5a5a56b274d6c38473f15367 b/explorer/fuzzing/fuzzer_corpus/2df14ada752970f5920c267c33f0308ef50f0246 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/87081db4d0965def5a5a56b274d6c38473f15367 rename to explorer/fuzzing/fuzzer_corpus/2df14ada752970f5920c267c33f0308ef50f0246 index a28cdad02da21..b02414ba802b5 100644 --- a/explorer/fuzzing/fuzzer_corpus/87081db4d0965def5a5a56b274d6c38473f15367 +++ b/explorer/fuzzing/fuzzer_corpus/2df14ada752970f5920c267c33f0308ef50f0246 @@ -64,9 +64,9 @@ compilation_unit { members { function { name: "Convert" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -98,7 +98,7 @@ compilation_unit { field: "v1" object { identifier { - name: "me" + name: "self" } } } @@ -108,7 +108,7 @@ compilation_unit { field: "v2" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/099a7eccb906876e50a4d9e1725e3a9adcc8a742 b/explorer/fuzzing/fuzzer_corpus/304589d53b5ac70ae5b20bfb211e9ef2ef89c303 similarity index 99% rename from explorer/fuzzing/fuzzer_corpus/099a7eccb906876e50a4d9e1725e3a9adcc8a742 rename to explorer/fuzzing/fuzzer_corpus/304589d53b5ac70ae5b20bfb211e9ef2ef89c303 index f95456741248e..1e74769df6c02 100644 --- a/explorer/fuzzing/fuzzer_corpus/099a7eccb906876e50a4d9e1725e3a9adcc8a742 +++ b/explorer/fuzzing/fuzzer_corpus/304589d53b5ac70ae5b20bfb211e9ef2ef89c303 @@ -36,9 +36,9 @@ compilation_unit { members { function { name: "Convert" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { diff --git a/explorer/fuzzing/fuzzer_corpus/32e0eb929035d7c53b3d8566ac48ef0c3b82b32e b/explorer/fuzzing/fuzzer_corpus/38e8259579859a4b14e6589509b1c58c427e5e50 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/32e0eb929035d7c53b3d8566ac48ef0c3b82b32e rename to explorer/fuzzing/fuzzer_corpus/38e8259579859a4b14e6589509b1c58c427e5e50 index 97189db61713c..be2d26e16881f 100644 --- a/explorer/fuzzing/fuzzer_corpus/32e0eb929035d7c53b3d8566ac48ef0c3b82b32e +++ b/explorer/fuzzing/fuzzer_corpus/38e8259579859a4b14e6589509b1c58c427e5e50 @@ -24,9 +24,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -162,9 +162,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -205,7 +205,7 @@ compilation_unit { op: Add arguments { identifier { - name: "me" + name: "self" } } arguments { @@ -318,9 +318,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -373,7 +373,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -409,7 +409,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/b1573ca8e10fba91022153f79d51a3a8cd989c98 b/explorer/fuzzing/fuzzer_corpus/399e83ac13c818d8ade85dda1d4918aa459186c9 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/b1573ca8e10fba91022153f79d51a3a8cd989c98 rename to explorer/fuzzing/fuzzer_corpus/399e83ac13c818d8ade85dda1d4918aa459186c9 index 1b8bf97e82930..c0a11d2450286 100644 --- a/explorer/fuzzing/fuzzer_corpus/b1573ca8e10fba91022153f79d51a3a8cd989c98 +++ b/explorer/fuzzing/fuzzer_corpus/399e83ac13c818d8ade85dda1d4918aa459186c9 @@ -144,9 +144,9 @@ compilation_unit { members { function { name: "Convert" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -176,7 +176,7 @@ compilation_unit { field: "v" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/91e906e0d538a96c1414d805872f0a3159529471 b/explorer/fuzzing/fuzzer_corpus/3bc84abaa7693f3ca0f0681f6f1097e1766d9d89 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/91e906e0d538a96c1414d805872f0a3159529471 rename to explorer/fuzzing/fuzzer_corpus/3bc84abaa7693f3ca0f0681f6f1097e1766d9d89 index 7e4213c1d62a4..bd2825da4344c 100644 --- a/explorer/fuzzing/fuzzer_corpus/91e906e0d538a96c1414d805872f0a3159529471 +++ b/explorer/fuzzing/fuzzer_corpus/3bc84abaa7693f3ca0f0681f6f1097e1766d9d89 @@ -82,9 +82,9 @@ compilation_unit { members { function { name: "GetX" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -132,7 +132,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/e4909f9f7d6923c33db7e3dd3e292860721acfd3 b/explorer/fuzzing/fuzzer_corpus/3eb39ab6dba8cea78c2daebaf486a6be626ae7a6 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/e4909f9f7d6923c33db7e3dd3e292860721acfd3 rename to explorer/fuzzing/fuzzer_corpus/3eb39ab6dba8cea78c2daebaf486a6be626ae7a6 index 59f56ec98ca61..f7a22579df108 100644 --- a/explorer/fuzzing/fuzzer_corpus/e4909f9f7d6923c33db7e3dd3e292860721acfd3 +++ b/explorer/fuzzing/fuzzer_corpus/3eb39ab6dba8cea78c2daebaf486a6be626ae7a6 @@ -45,9 +45,9 @@ compilation_unit { members { function { name: "Convert" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -91,7 +91,7 @@ compilation_unit { op: Add arguments { identifier { - name: "me" + name: "self" } } arguments { diff --git a/explorer/fuzzing/fuzzer_corpus/06a307aa1f2980c9c38aec7f31dc5c6c2cdb29f9 b/explorer/fuzzing/fuzzer_corpus/3ed8ca560ef34c454714552d051ec8d184dda8c3 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/06a307aa1f2980c9c38aec7f31dc5c6c2cdb29f9 rename to explorer/fuzzing/fuzzer_corpus/3ed8ca560ef34c454714552d051ec8d184dda8c3 index 527e92be266f3..285823fdb67fb 100644 --- a/explorer/fuzzing/fuzzer_corpus/06a307aa1f2980c9c38aec7f31dc5c6c2cdb29f9 +++ b/explorer/fuzzing/fuzzer_corpus/3ed8ca560ef34c454714552d051ec8d184dda8c3 @@ -9,9 +9,9 @@ compilation_unit { members { function { name: "Get" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { diff --git a/explorer/fuzzing/fuzzer_corpus/a04fd176eb32a1a2500bf298f4f5deb37b9fa406 b/explorer/fuzzing/fuzzer_corpus/4511704cda32c21450acb1f1442ecc9f1979e9a5 similarity index 99% rename from explorer/fuzzing/fuzzer_corpus/a04fd176eb32a1a2500bf298f4f5deb37b9fa406 rename to explorer/fuzzing/fuzzer_corpus/4511704cda32c21450acb1f1442ecc9f1979e9a5 index 986e6f18d7153..613ca695dbe5a 100644 --- a/explorer/fuzzing/fuzzer_corpus/a04fd176eb32a1a2500bf298f4f5deb37b9fa406 +++ b/explorer/fuzzing/fuzzer_corpus/4511704cda32c21450acb1f1442ecc9f1979e9a5 @@ -24,9 +24,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -391,9 +391,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -434,7 +434,7 @@ compilation_unit { op: Add arguments { identifier { - name: "me" + name: "self" } } arguments { diff --git a/explorer/fuzzing/fuzzer_corpus/1844089b39db6518836420fcb6a5d37b3e99424f b/explorer/fuzzing/fuzzer_corpus/5a5456f6259ac15d8358430389aea12f145a44f7 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/1844089b39db6518836420fcb6a5d37b3e99424f rename to explorer/fuzzing/fuzzer_corpus/5a5456f6259ac15d8358430389aea12f145a44f7 index d8618786223af..3e692355e3d55 100644 --- a/explorer/fuzzing/fuzzer_corpus/1844089b39db6518836420fcb6a5d37b3e99424f +++ b/explorer/fuzzing/fuzzer_corpus/5a5456f6259ac15d8358430389aea12f145a44f7 @@ -9,9 +9,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -52,9 +52,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -149,9 +149,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -202,7 +202,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -230,7 +230,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } @@ -258,9 +258,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -310,7 +310,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -333,7 +333,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/ad532018fa2a099d303e2439b0c39557aecf8e00 b/explorer/fuzzing/fuzzer_corpus/5b0eabed769a089e9906772fe0dfc78b111fee38 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/ad532018fa2a099d303e2439b0c39557aecf8e00 rename to explorer/fuzzing/fuzzer_corpus/5b0eabed769a089e9906772fe0dfc78b111fee38 index a3f99dcfda8b6..2684c3348ecb1 100644 --- a/explorer/fuzzing/fuzzer_corpus/ad532018fa2a099d303e2439b0c39557aecf8e00 +++ b/explorer/fuzzing/fuzzer_corpus/5b0eabed769a089e9906772fe0dfc78b111fee38 @@ -9,9 +9,9 @@ compilation_unit { members { function { name: "F" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { diff --git a/explorer/fuzzing/fuzzer_corpus/fe3c5db046e0dae74603f2c43ed1af68eea9a6ae b/explorer/fuzzing/fuzzer_corpus/5bd03bcc54eb9664e91595ce320d14f133233e73 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/fe3c5db046e0dae74603f2c43ed1af68eea9a6ae rename to explorer/fuzzing/fuzzer_corpus/5bd03bcc54eb9664e91595ce320d14f133233e73 index 9bc4df435ada2..f7ee7e2aae36d 100644 --- a/explorer/fuzzing/fuzzer_corpus/fe3c5db046e0dae74603f2c43ed1af68eea9a6ae +++ b/explorer/fuzzing/fuzzer_corpus/5bd03bcc54eb9664e91595ce320d14f133233e73 @@ -24,9 +24,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -67,9 +67,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -218,9 +218,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -271,7 +271,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -299,7 +299,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } @@ -327,9 +327,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -379,7 +379,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -402,7 +402,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/6387e3e0d1ddb4ad2178b62b08b5812d4181fc75 b/explorer/fuzzing/fuzzer_corpus/5c1540feb494c79e5f20e6f87651be05325cac4b similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/6387e3e0d1ddb4ad2178b62b08b5812d4181fc75 rename to explorer/fuzzing/fuzzer_corpus/5c1540feb494c79e5f20e6f87651be05325cac4b index 200461474cf3d..d1d3663596f6c 100644 --- a/explorer/fuzzing/fuzzer_corpus/6387e3e0d1ddb4ad2178b62b08b5812d4181fc75 +++ b/explorer/fuzzing/fuzzer_corpus/5c1540feb494c79e5f20e6f87651be05325cac4b @@ -9,9 +9,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -52,9 +52,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { diff --git a/explorer/fuzzing/fuzzer_corpus/b2bb0268ca91b380d18d8b4e26f8188830ad584b b/explorer/fuzzing/fuzzer_corpus/6318884693dd31430b4b46b1305dae63f281751e similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/b2bb0268ca91b380d18d8b4e26f8188830ad584b rename to explorer/fuzzing/fuzzer_corpus/6318884693dd31430b4b46b1305dae63f281751e index 67870488109da..8991d91d8e696 100644 --- a/explorer/fuzzing/fuzzer_corpus/b2bb0268ca91b380d18d8b4e26f8188830ad584b +++ b/explorer/fuzzing/fuzzer_corpus/6318884693dd31430b4b46b1305dae63f281751e @@ -50,9 +50,9 @@ compilation_unit { members { function { name: "GetX" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -81,7 +81,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/8807065998e566eda4a26e9d9ec50f8938b46253 b/explorer/fuzzing/fuzzer_corpus/64618fd348511e00ac19df9a99ac61329f13235a similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/8807065998e566eda4a26e9d9ec50f8938b46253 rename to explorer/fuzzing/fuzzer_corpus/64618fd348511e00ac19df9a99ac61329f13235a index afb28da6aaa15..5ebdf7758c186 100644 --- a/explorer/fuzzing/fuzzer_corpus/8807065998e566eda4a26e9d9ec50f8938b46253 +++ b/explorer/fuzzing/fuzzer_corpus/64618fd348511e00ac19df9a99ac61329f13235a @@ -9,9 +9,9 @@ compilation_unit { members { function { name: "F" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -62,7 +62,7 @@ compilation_unit { field: "n" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/3db1646f25e3f628cf0219a651539b07f20df403 b/explorer/fuzzing/fuzzer_corpus/6767a2eb95f450545192b2ad69022bcbfe0ec98d similarity index 99% rename from explorer/fuzzing/fuzzer_corpus/3db1646f25e3f628cf0219a651539b07f20df403 rename to explorer/fuzzing/fuzzer_corpus/6767a2eb95f450545192b2ad69022bcbfe0ec98d index 7068551a77cc6..5ebe69d7ea821 100644 --- a/explorer/fuzzing/fuzzer_corpus/3db1646f25e3f628cf0219a651539b07f20df403 +++ b/explorer/fuzzing/fuzzer_corpus/6767a2eb95f450545192b2ad69022bcbfe0ec98d @@ -23,9 +23,9 @@ compilation_unit { members { function { name: "M" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -116,9 +116,9 @@ compilation_unit { members { function { name: "M" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -157,9 +157,9 @@ compilation_unit { members { function { name: "G" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -235,9 +235,9 @@ compilation_unit { members { function { name: "M" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { diff --git a/explorer/fuzzing/fuzzer_corpus/b3be1b28b64d4a3b2da9d7a2da48e4094e7102bf b/explorer/fuzzing/fuzzer_corpus/68a5800e6a2dbe2f732129fe874f20bbb42b90b5 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/b3be1b28b64d4a3b2da9d7a2da48e4094e7102bf rename to explorer/fuzzing/fuzzer_corpus/68a5800e6a2dbe2f732129fe874f20bbb42b90b5 index 3edd5848c2915..a1f611f515f53 100644 --- a/explorer/fuzzing/fuzzer_corpus/b3be1b28b64d4a3b2da9d7a2da48e4094e7102bf +++ b/explorer/fuzzing/fuzzer_corpus/68a5800e6a2dbe2f732129fe874f20bbb42b90b5 @@ -9,9 +9,9 @@ compilation_unit { members { function { name: "Go" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -76,9 +76,9 @@ compilation_unit { members { function { name: "Go" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { diff --git a/explorer/fuzzing/fuzzer_corpus/6c86299b17c54466628587a48c2ec0e9d3029fc7 b/explorer/fuzzing/fuzzer_corpus/69085645b1858d4812fa018eb8c1addb630253d1 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/6c86299b17c54466628587a48c2ec0e9d3029fc7 rename to explorer/fuzzing/fuzzer_corpus/69085645b1858d4812fa018eb8c1addb630253d1 index 5f5a0d1e2f809..13d98e4303ef4 100644 --- a/explorer/fuzzing/fuzzer_corpus/6c86299b17c54466628587a48c2ec0e9d3029fc7 +++ b/explorer/fuzzing/fuzzer_corpus/69085645b1858d4812fa018eb8c1addb630253d1 @@ -9,9 +9,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -52,9 +52,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -149,9 +149,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -202,7 +202,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -230,7 +230,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } @@ -258,9 +258,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -310,7 +310,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -333,7 +333,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } @@ -406,9 +406,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -462,7 +462,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -500,7 +500,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } @@ -535,9 +535,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -590,7 +590,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -623,7 +623,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/0ee3d72e3cab1b0907f04f35b2d33fb946ab32c9 b/explorer/fuzzing/fuzzer_corpus/6a7199401d7f3938c79c0e967ebea78837a94a95 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/0ee3d72e3cab1b0907f04f35b2d33fb946ab32c9 rename to explorer/fuzzing/fuzzer_corpus/6a7199401d7f3938c79c0e967ebea78837a94a95 index 1e1fb7b6af62e..f501abe2370f5 100644 --- a/explorer/fuzzing/fuzzer_corpus/0ee3d72e3cab1b0907f04f35b2d33fb946ab32c9 +++ b/explorer/fuzzing/fuzzer_corpus/6a7199401d7f3938c79c0e967ebea78837a94a95 @@ -24,9 +24,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -67,9 +67,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -244,9 +244,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -333,7 +333,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -361,7 +361,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } @@ -389,9 +389,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -465,7 +465,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -488,7 +488,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/259e262f9509cb8a3e564d29d397ae42670b3c9c b/explorer/fuzzing/fuzzer_corpus/6a879cdde713ac9009864ed5f9912616d314e017 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/259e262f9509cb8a3e564d29d397ae42670b3c9c rename to explorer/fuzzing/fuzzer_corpus/6a879cdde713ac9009864ed5f9912616d314e017 index 9475c118cff88..ed7f4eb953422 100644 --- a/explorer/fuzzing/fuzzer_corpus/259e262f9509cb8a3e564d29d397ae42670b3c9c +++ b/explorer/fuzzing/fuzzer_corpus/6a879cdde713ac9009864ed5f9912616d314e017 @@ -90,9 +90,9 @@ compilation_unit { members { function { name: "GetX" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -148,7 +148,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/f7aeea2890977521805eb676011bb0223b46872f b/explorer/fuzzing/fuzzer_corpus/6b2bafceac3d58159bd93269556e1db2ea9c1470 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/f7aeea2890977521805eb676011bb0223b46872f rename to explorer/fuzzing/fuzzer_corpus/6b2bafceac3d58159bd93269556e1db2ea9c1470 index 7f9fb81a782c0..3ece606f00284 100644 --- a/explorer/fuzzing/fuzzer_corpus/f7aeea2890977521805eb676011bb0223b46872f +++ b/explorer/fuzzing/fuzzer_corpus/6b2bafceac3d58159bd93269556e1db2ea9c1470 @@ -9,9 +9,9 @@ compilation_unit { members { function { name: "F" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -77,9 +77,9 @@ compilation_unit { members { function { name: "F" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -130,7 +130,7 @@ compilation_unit { field: "n" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/b77f65badb388ae3942c31237a85c8826c4e5648 b/explorer/fuzzing/fuzzer_corpus/6c25c16bd50745570b78bee439871f5d6a0ca621 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/b77f65badb388ae3942c31237a85c8826c4e5648 rename to explorer/fuzzing/fuzzer_corpus/6c25c16bd50745570b78bee439871f5d6a0ca621 index 415db322df157..17110ca438966 100644 --- a/explorer/fuzzing/fuzzer_corpus/b77f65badb388ae3942c31237a85c8826c4e5648 +++ b/explorer/fuzzing/fuzzer_corpus/6c25c16bd50745570b78bee439871f5d6a0ca621 @@ -77,9 +77,9 @@ compilation_unit { members { function { name: "GetX" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -122,7 +122,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/b77f0f9be78ea2cf33d09e3ac7991e7560b8279f b/explorer/fuzzing/fuzzer_corpus/781ecc36990e2394a0c6823855c583aae691bc78 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/b77f0f9be78ea2cf33d09e3ac7991e7560b8279f rename to explorer/fuzzing/fuzzer_corpus/781ecc36990e2394a0c6823855c583aae691bc78 index 7f3f6c6d02b4f..723fdc5b7adc6 100644 --- a/explorer/fuzzing/fuzzer_corpus/b77f0f9be78ea2cf33d09e3ac7991e7560b8279f +++ b/explorer/fuzzing/fuzzer_corpus/781ecc36990e2394a0c6823855c583aae691bc78 @@ -51,9 +51,9 @@ compilation_unit { members { function { name: "Convert" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -84,7 +84,7 @@ compilation_unit { name: "n" expression { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/74c8e2e43c65d4be09ca220e6512569aeecec513 b/explorer/fuzzing/fuzzer_corpus/7da9f665980aa154e3e04524ab6284d08ede8f80 similarity index 99% rename from explorer/fuzzing/fuzzer_corpus/74c8e2e43c65d4be09ca220e6512569aeecec513 rename to explorer/fuzzing/fuzzer_corpus/7da9f665980aa154e3e04524ab6284d08ede8f80 index 2747607e98b80..f852bd0b8612f 100644 --- a/explorer/fuzzing/fuzzer_corpus/74c8e2e43c65d4be09ca220e6512569aeecec513 +++ b/explorer/fuzzing/fuzzer_corpus/7da9f665980aa154e3e04524ab6284d08ede8f80 @@ -9,9 +9,9 @@ compilation_unit { members { function { name: "F" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -104,9 +104,9 @@ compilation_unit { members { function { name: "F" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -179,7 +179,7 @@ compilation_unit { field: "n" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/0c441139ce210274afe7f2964745701c9957c672 b/explorer/fuzzing/fuzzer_corpus/7eabea18523cea963d3c7b0150afb7101805e32f similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/0c441139ce210274afe7f2964745701c9957c672 rename to explorer/fuzzing/fuzzer_corpus/7eabea18523cea963d3c7b0150afb7101805e32f index f56f801dae80b..4453333580267 100644 --- a/explorer/fuzzing/fuzzer_corpus/0c441139ce210274afe7f2964745701c9957c672 +++ b/explorer/fuzzing/fuzzer_corpus/7eabea18523cea963d3c7b0150afb7101805e32f @@ -9,9 +9,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -186,9 +186,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -239,7 +239,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -267,7 +267,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/d44b1b3f6ff018d0829e0d73f551d0144b39e638 b/explorer/fuzzing/fuzzer_corpus/8188e039b6d4d48035b5f86993575212c01d248a similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/d44b1b3f6ff018d0829e0d73f551d0144b39e638 rename to explorer/fuzzing/fuzzer_corpus/8188e039b6d4d48035b5f86993575212c01d248a index 29e8b2dde7837..3d8c4f090a469 100644 --- a/explorer/fuzzing/fuzzer_corpus/d44b1b3f6ff018d0829e0d73f551d0144b39e638 +++ b/explorer/fuzzing/fuzzer_corpus/8188e039b6d4d48035b5f86993575212c01d248a @@ -9,9 +9,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -52,9 +52,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -151,9 +151,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -204,7 +204,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -232,7 +232,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } @@ -260,9 +260,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -312,7 +312,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -335,7 +335,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/afa03ca87919d5338ae7a96eea4047ff62d7bfc6 b/explorer/fuzzing/fuzzer_corpus/82280e14d4c28c51272136e746d7f54c25095951 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/afa03ca87919d5338ae7a96eea4047ff62d7bfc6 rename to explorer/fuzzing/fuzzer_corpus/82280e14d4c28c51272136e746d7f54c25095951 index d8fb2d240c854..827a1ae6f84e2 100644 --- a/explorer/fuzzing/fuzzer_corpus/afa03ca87919d5338ae7a96eea4047ff62d7bfc6 +++ b/explorer/fuzzing/fuzzer_corpus/82280e14d4c28c51272136e746d7f54c25095951 @@ -9,9 +9,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -52,9 +52,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -149,9 +149,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -202,7 +202,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -230,7 +230,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } @@ -258,9 +258,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { diff --git a/explorer/fuzzing/fuzzer_corpus/472b9f7d613316693d56e49f236877cde0caaa75 b/explorer/fuzzing/fuzzer_corpus/826fa4abee30374c115463db29d4a94c4ca3c98f similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/472b9f7d613316693d56e49f236877cde0caaa75 rename to explorer/fuzzing/fuzzer_corpus/826fa4abee30374c115463db29d4a94c4ca3c98f index dabeca9e629c6..db8432b7422c3 100644 --- a/explorer/fuzzing/fuzzer_corpus/472b9f7d613316693d56e49f236877cde0caaa75 +++ b/explorer/fuzzing/fuzzer_corpus/826fa4abee30374c115463db29d4a94c4ca3c98f @@ -34,9 +34,9 @@ compilation_unit { members { function { name: "Convert" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -65,7 +65,7 @@ compilation_unit { field: "n" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/81b5d416277f5b28d98ac9b175f73389d9857655 b/explorer/fuzzing/fuzzer_corpus/864211adf7c5880a4c7862aed73b7ac0ac32b8a9 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/81b5d416277f5b28d98ac9b175f73389d9857655 rename to explorer/fuzzing/fuzzer_corpus/864211adf7c5880a4c7862aed73b7ac0ac32b8a9 index d52266788357a..1aae1060b8d28 100644 --- a/explorer/fuzzing/fuzzer_corpus/81b5d416277f5b28d98ac9b175f73389d9857655 +++ b/explorer/fuzzing/fuzzer_corpus/864211adf7c5880a4c7862aed73b7ac0ac32b8a9 @@ -24,9 +24,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -67,9 +67,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -232,9 +232,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -285,7 +285,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -313,7 +313,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } @@ -341,9 +341,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -393,7 +393,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -416,7 +416,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/b66e41a2708c436beb8806408f41f8b6d037cc87 b/explorer/fuzzing/fuzzer_corpus/8e41e48db8e0f14feea263e6c49c835b1b2ce53f similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/b66e41a2708c436beb8806408f41f8b6d037cc87 rename to explorer/fuzzing/fuzzer_corpus/8e41e48db8e0f14feea263e6c49c835b1b2ce53f index e097468501e06..43b76d600fe90 100644 --- a/explorer/fuzzing/fuzzer_corpus/b66e41a2708c436beb8806408f41f8b6d037cc87 +++ b/explorer/fuzzing/fuzzer_corpus/8e41e48db8e0f14feea263e6c49c835b1b2ce53f @@ -70,10 +70,10 @@ compilation_unit { members { function { name: "GetSetX" - me_pattern { + self_pattern { addr_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -133,7 +133,7 @@ compilation_unit { op: Deref arguments { identifier { - name: "me" + name: "self" } } } @@ -152,7 +152,7 @@ compilation_unit { op: Deref arguments { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/7b7e24319e8f63e6c3e99f8cbc81da7e9e47390a b/explorer/fuzzing/fuzzer_corpus/97d6542094ef4b6e4322cddf33f59440c5b6ea61 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/7b7e24319e8f63e6c3e99f8cbc81da7e9e47390a rename to explorer/fuzzing/fuzzer_corpus/97d6542094ef4b6e4322cddf33f59440c5b6ea61 index e13d1cf4d475d..3ab2ba2adcf44 100644 --- a/explorer/fuzzing/fuzzer_corpus/7b7e24319e8f63e6c3e99f8cbc81da7e9e47390a +++ b/explorer/fuzzing/fuzzer_corpus/97d6542094ef4b6e4322cddf33f59440c5b6ea61 @@ -24,9 +24,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -67,9 +67,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -205,9 +205,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -258,7 +258,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -286,7 +286,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } @@ -314,9 +314,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -366,7 +366,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -389,7 +389,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/308d94ff5bf03c10d183bace81bc2f3641a68311 b/explorer/fuzzing/fuzzer_corpus/981655702b85acf10978cdb81df86b9399788092 similarity index 99% rename from explorer/fuzzing/fuzzer_corpus/308d94ff5bf03c10d183bace81bc2f3641a68311 rename to explorer/fuzzing/fuzzer_corpus/981655702b85acf10978cdb81df86b9399788092 index 7eeabe90f6134..6bc47fdce33a2 100644 --- a/explorer/fuzzing/fuzzer_corpus/308d94ff5bf03c10d183bace81bc2f3641a68311 +++ b/explorer/fuzzing/fuzzer_corpus/981655702b85acf10978cdb81df86b9399788092 @@ -36,9 +36,9 @@ compilation_unit { members { function { name: "Convert" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { diff --git a/explorer/fuzzing/fuzzer_corpus/b9378e44d8b809e19d29c58997a302f6596c34e5 b/explorer/fuzzing/fuzzer_corpus/9c9fc5cca447d05d54f0200271e4cc6d228fe056 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/b9378e44d8b809e19d29c58997a302f6596c34e5 rename to explorer/fuzzing/fuzzer_corpus/9c9fc5cca447d05d54f0200271e4cc6d228fe056 index 62aca53485083..b2ce82ee65d60 100644 --- a/explorer/fuzzing/fuzzer_corpus/b9378e44d8b809e19d29c58997a302f6596c34e5 +++ b/explorer/fuzzing/fuzzer_corpus/9c9fc5cca447d05d54f0200271e4cc6d228fe056 @@ -9,9 +9,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -72,9 +72,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -117,7 +117,7 @@ compilation_unit { op: Add arguments { identifier { - name: "me" + name: "self" } } arguments { @@ -176,9 +176,9 @@ compilation_unit { members { function { name: "Get" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -226,7 +226,7 @@ compilation_unit { field: "m" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/99aed9e0efcdc0473a19a23e77d687971bf6fb08 b/explorer/fuzzing/fuzzer_corpus/9e4121f79f2fee85e9964bebf21543de57c1d439 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/99aed9e0efcdc0473a19a23e77d687971bf6fb08 rename to explorer/fuzzing/fuzzer_corpus/9e4121f79f2fee85e9964bebf21543de57c1d439 index 1434ddeff37ea..96d794ed8e091 100644 --- a/explorer/fuzzing/fuzzer_corpus/99aed9e0efcdc0473a19a23e77d687971bf6fb08 +++ b/explorer/fuzzing/fuzzer_corpus/9e4121f79f2fee85e9964bebf21543de57c1d439 @@ -24,9 +24,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -67,9 +67,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -205,9 +205,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -258,7 +258,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -286,7 +286,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } @@ -314,9 +314,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -366,7 +366,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -389,7 +389,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/f0249ef671686916199dbce1467d741102a68717 b/explorer/fuzzing/fuzzer_corpus/a394d42f77cdc9659ff63881715f4852eea0a3af similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/f0249ef671686916199dbce1467d741102a68717 rename to explorer/fuzzing/fuzzer_corpus/a394d42f77cdc9659ff63881715f4852eea0a3af index 6d5544f5b956c..35c8e0b51ddb4 100644 --- a/explorer/fuzzing/fuzzer_corpus/f0249ef671686916199dbce1467d741102a68717 +++ b/explorer/fuzzing/fuzzer_corpus/a394d42f77cdc9659ff63881715f4852eea0a3af @@ -24,9 +24,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -162,9 +162,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -205,7 +205,7 @@ compilation_unit { op: Add arguments { identifier { - name: "me" + name: "self" } } arguments { @@ -331,9 +331,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -425,7 +425,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -461,7 +461,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/017a765e283355ded618ed95de5da4e3f2dd4b52 b/explorer/fuzzing/fuzzer_corpus/a5808cf255331e29840cb6878f8a4732c4bd6a08 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/017a765e283355ded618ed95de5da4e3f2dd4b52 rename to explorer/fuzzing/fuzzer_corpus/a5808cf255331e29840cb6878f8a4732c4bd6a08 index 4de48decfd4fd..d2d91230fb931 100644 --- a/explorer/fuzzing/fuzzer_corpus/017a765e283355ded618ed95de5da4e3f2dd4b52 +++ b/explorer/fuzzing/fuzzer_corpus/a5808cf255331e29840cb6878f8a4732c4bd6a08 @@ -9,9 +9,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -52,9 +52,9 @@ compilation_unit { members { function { name: "Mul" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -116,9 +116,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -159,7 +159,7 @@ compilation_unit { op: Add arguments { identifier { - name: "me" + name: "self" } } arguments { @@ -177,9 +177,9 @@ compilation_unit { members { function { name: "Mul" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -220,7 +220,7 @@ compilation_unit { op: Mul arguments { identifier { - name: "me" + name: "self" } } arguments { @@ -291,9 +291,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -334,9 +334,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -377,9 +377,9 @@ compilation_unit { members { function { name: "Hold" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -541,9 +541,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -594,7 +594,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -622,7 +622,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } @@ -650,9 +650,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -702,7 +702,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -725,7 +725,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } @@ -748,9 +748,9 @@ compilation_unit { members { function { name: "Hold" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { diff --git a/explorer/fuzzing/fuzzer_corpus/7f14266137c07dea7d4c7fa0f7f2ca6346cf4c66 b/explorer/fuzzing/fuzzer_corpus/a63c576d4b2e1a63c3f9b960c861f9ba7513bb67 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/7f14266137c07dea7d4c7fa0f7f2ca6346cf4c66 rename to explorer/fuzzing/fuzzer_corpus/a63c576d4b2e1a63c3f9b960c861f9ba7513bb67 index 1bf4d7422450a..94c8c2a9c18ff 100644 --- a/explorer/fuzzing/fuzzer_corpus/7f14266137c07dea7d4c7fa0f7f2ca6346cf4c66 +++ b/explorer/fuzzing/fuzzer_corpus/a63c576d4b2e1a63c3f9b960c861f9ba7513bb67 @@ -24,10 +24,10 @@ compilation_unit { members { function { name: "GetSetX" - me_pattern { + self_pattern { addr_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -87,7 +87,7 @@ compilation_unit { op: Deref arguments { identifier { - name: "me" + name: "self" } } } @@ -106,7 +106,7 @@ compilation_unit { op: Deref arguments { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/5e4bce73c210e45269126773f257d95d4d269072 b/explorer/fuzzing/fuzzer_corpus/a71bb2c74fc34cb14adf428db9dd48e6ada14bb6 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/5e4bce73c210e45269126773f257d95d4d269072 rename to explorer/fuzzing/fuzzer_corpus/a71bb2c74fc34cb14adf428db9dd48e6ada14bb6 index e9aa35dfc4475..1cfe4c4cc0279 100644 --- a/explorer/fuzzing/fuzzer_corpus/5e4bce73c210e45269126773f257d95d4d269072 +++ b/explorer/fuzzing/fuzzer_corpus/a71bb2c74fc34cb14adf428db9dd48e6ada14bb6 @@ -9,9 +9,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -52,9 +52,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -151,9 +151,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -204,7 +204,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -232,7 +232,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } @@ -260,9 +260,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -312,7 +312,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -335,7 +335,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/35a3028fcdb70945c6c7db9e7154b08543f0dc17 b/explorer/fuzzing/fuzzer_corpus/b1f2cfe33f8d50f38ce8addd62b76519bd589d9e similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/35a3028fcdb70945c6c7db9e7154b08543f0dc17 rename to explorer/fuzzing/fuzzer_corpus/b1f2cfe33f8d50f38ce8addd62b76519bd589d9e index 76c1a2d9ddd99..eed7a81f8534a 100644 --- a/explorer/fuzzing/fuzzer_corpus/35a3028fcdb70945c6c7db9e7154b08543f0dc17 +++ b/explorer/fuzzing/fuzzer_corpus/b1f2cfe33f8d50f38ce8addd62b76519bd589d9e @@ -6,9 +6,9 @@ compilation_unit { declarations { function { name: "F" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { diff --git a/explorer/fuzzing/fuzzer_corpus/b015582cdd9a7b03f83d7001537d32e4ea123946 b/explorer/fuzzing/fuzzer_corpus/b32e22f8b9b251438cf5d689f5f077daaa3f3bdf similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/b015582cdd9a7b03f83d7001537d32e4ea123946 rename to explorer/fuzzing/fuzzer_corpus/b32e22f8b9b251438cf5d689f5f077daaa3f3bdf index c1dcef35fde0d..3cc0cfada26fa 100644 --- a/explorer/fuzzing/fuzzer_corpus/b015582cdd9a7b03f83d7001537d32e4ea123946 +++ b/explorer/fuzzing/fuzzer_corpus/b32e22f8b9b251438cf5d689f5f077daaa3f3bdf @@ -50,10 +50,10 @@ compilation_unit { members { function { name: "GetSetX" - me_pattern { + self_pattern { addr_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -113,7 +113,7 @@ compilation_unit { op: Deref arguments { identifier { - name: "me" + name: "self" } } } @@ -132,7 +132,7 @@ compilation_unit { op: Deref arguments { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/fda984fd483f47ca29fd55b54173f77ef690b4ee b/explorer/fuzzing/fuzzer_corpus/b8c12a825a41b0b25af0f44a119d6993f90af611 similarity index 99% rename from explorer/fuzzing/fuzzer_corpus/fda984fd483f47ca29fd55b54173f77ef690b4ee rename to explorer/fuzzing/fuzzer_corpus/b8c12a825a41b0b25af0f44a119d6993f90af611 index 68f73f1db476f..d51fe524d7d84 100644 --- a/explorer/fuzzing/fuzzer_corpus/fda984fd483f47ca29fd55b54173f77ef690b4ee +++ b/explorer/fuzzing/fuzzer_corpus/b8c12a825a41b0b25af0f44a119d6993f90af611 @@ -24,9 +24,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -452,9 +452,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -495,7 +495,7 @@ compilation_unit { op: Add arguments { identifier { - name: "me" + name: "self" } } arguments { diff --git a/explorer/fuzzing/fuzzer_corpus/a88508d94032d0429d1cba11c1df90deb142c155 b/explorer/fuzzing/fuzzer_corpus/b8e05ecd5da75a6af34295d2396d27fec1cfd4d5 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/a88508d94032d0429d1cba11c1df90deb142c155 rename to explorer/fuzzing/fuzzer_corpus/b8e05ecd5da75a6af34295d2396d27fec1cfd4d5 index 5634f6b14f11e..61cffd2da7cc2 100644 --- a/explorer/fuzzing/fuzzer_corpus/a88508d94032d0429d1cba11c1df90deb142c155 +++ b/explorer/fuzzing/fuzzer_corpus/b8e05ecd5da75a6af34295d2396d27fec1cfd4d5 @@ -50,9 +50,9 @@ compilation_unit { members { function { name: "GetX" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -81,7 +81,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/b671a41b29603d99d57b69e15c8ee86017b58555 b/explorer/fuzzing/fuzzer_corpus/be2a3f66b52634d15b9e34c0ed93ce8ffebcd527 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/b671a41b29603d99d57b69e15c8ee86017b58555 rename to explorer/fuzzing/fuzzer_corpus/be2a3f66b52634d15b9e34c0ed93ce8ffebcd527 index 2b635c443b1aa..832f49ae478ad 100644 --- a/explorer/fuzzing/fuzzer_corpus/b671a41b29603d99d57b69e15c8ee86017b58555 +++ b/explorer/fuzzing/fuzzer_corpus/be2a3f66b52634d15b9e34c0ed93ce8ffebcd527 @@ -50,9 +50,9 @@ compilation_unit { members { function { name: "GetX" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -81,7 +81,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/5357de7edef4e3bff993192d9538493ae80f5fa8 b/explorer/fuzzing/fuzzer_corpus/c0f26047718df883b42cab5fd891a7a58663d5fd similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/5357de7edef4e3bff993192d9538493ae80f5fa8 rename to explorer/fuzzing/fuzzer_corpus/c0f26047718df883b42cab5fd891a7a58663d5fd index 36344b9b2eb5c..e8f29b5e14aa2 100644 --- a/explorer/fuzzing/fuzzer_corpus/5357de7edef4e3bff993192d9538493ae80f5fa8 +++ b/explorer/fuzzing/fuzzer_corpus/c0f26047718df883b42cab5fd891a7a58663d5fd @@ -24,9 +24,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -159,9 +159,9 @@ compilation_unit { members { function { name: "Clone" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -221,7 +221,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -234,7 +234,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } @@ -250,9 +250,9 @@ compilation_unit { members { function { name: "SumXY" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -300,7 +300,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -314,7 +314,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } @@ -414,9 +414,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -457,7 +457,7 @@ compilation_unit { op: Add arguments { identifier { - name: "me" + name: "self" } } arguments { diff --git a/explorer/fuzzing/fuzzer_corpus/ad6c39ea6ec9ed5867500173d2aaa1200bbc06a6 b/explorer/fuzzing/fuzzer_corpus/c2646dc4add2384ca4c733a9a706b218397cc1c8 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/ad6c39ea6ec9ed5867500173d2aaa1200bbc06a6 rename to explorer/fuzzing/fuzzer_corpus/c2646dc4add2384ca4c733a9a706b218397cc1c8 index f1e2fc3879a7a..edb0569e5e540 100644 --- a/explorer/fuzzing/fuzzer_corpus/ad6c39ea6ec9ed5867500173d2aaa1200bbc06a6 +++ b/explorer/fuzzing/fuzzer_corpus/c2646dc4add2384ca4c733a9a706b218397cc1c8 @@ -51,9 +51,9 @@ compilation_unit { members { function { name: "Convert" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -84,7 +84,7 @@ compilation_unit { name: "n" expression { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/f322da95d8d8422e659c3c23d2f7aa3193efb25f b/explorer/fuzzing/fuzzer_corpus/c7d4d21e67b7c6a1f952e22f81fcb158a53e208d similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/f322da95d8d8422e659c3c23d2f7aa3193efb25f rename to explorer/fuzzing/fuzzer_corpus/c7d4d21e67b7c6a1f952e22f81fcb158a53e208d index 81585fbccec40..3a44af3c7be7f 100644 --- a/explorer/fuzzing/fuzzer_corpus/f322da95d8d8422e659c3c23d2f7aa3193efb25f +++ b/explorer/fuzzing/fuzzer_corpus/c7d4d21e67b7c6a1f952e22f81fcb158a53e208d @@ -9,9 +9,9 @@ compilation_unit { members { function { name: "Convert" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -58,9 +58,9 @@ compilation_unit { members { function { name: "Convert" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -85,7 +85,7 @@ compilation_unit { return_statement { expression { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/9bb0b055035cb4965aa9432c34bdb1be0f8c3b80 b/explorer/fuzzing/fuzzer_corpus/cd31cdffa19ef031d14c0d3440a7d14f2433b923 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/9bb0b055035cb4965aa9432c34bdb1be0f8c3b80 rename to explorer/fuzzing/fuzzer_corpus/cd31cdffa19ef031d14c0d3440a7d14f2433b923 index ec0a2dd28ec8a..4f5011a9a11b9 100644 --- a/explorer/fuzzing/fuzzer_corpus/9bb0b055035cb4965aa9432c34bdb1be0f8c3b80 +++ b/explorer/fuzzing/fuzzer_corpus/cd31cdffa19ef031d14c0d3440a7d14f2433b923 @@ -9,9 +9,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -52,9 +52,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -149,9 +149,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -202,7 +202,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -230,7 +230,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } @@ -258,9 +258,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -310,7 +310,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -333,7 +333,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/63979179f0b4279dbf7a98a3a7b9837393d43e8a b/explorer/fuzzing/fuzzer_corpus/ce85fb106849dde89ccc11e6ff799faa8c74af07 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/63979179f0b4279dbf7a98a3a7b9837393d43e8a rename to explorer/fuzzing/fuzzer_corpus/ce85fb106849dde89ccc11e6ff799faa8c74af07 index adec5eb19b21d..2ff8c6126c079 100644 --- a/explorer/fuzzing/fuzzer_corpus/63979179f0b4279dbf7a98a3a7b9837393d43e8a +++ b/explorer/fuzzing/fuzzer_corpus/ce85fb106849dde89ccc11e6ff799faa8c74af07 @@ -64,9 +64,9 @@ compilation_unit { members { function { name: "GetX" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -96,7 +96,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/06f83aef3f9e01311a3278cd23a2abc77c49915f b/explorer/fuzzing/fuzzer_corpus/ce8a72d8214224c0cf6cd1208452aa86ddb41a3c similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/06f83aef3f9e01311a3278cd23a2abc77c49915f rename to explorer/fuzzing/fuzzer_corpus/ce8a72d8214224c0cf6cd1208452aa86ddb41a3c index a4f580a273f0e..56fcafb024330 100644 --- a/explorer/fuzzing/fuzzer_corpus/06f83aef3f9e01311a3278cd23a2abc77c49915f +++ b/explorer/fuzzing/fuzzer_corpus/ce8a72d8214224c0cf6cd1208452aa86ddb41a3c @@ -77,9 +77,9 @@ compilation_unit { members { function { name: "GetX" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -122,7 +122,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/d415017d19f5638734278f41adaa345e510f90d2 b/explorer/fuzzing/fuzzer_corpus/d1e5a00347368e94959ff07b93e4c6a0762091a8 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/d415017d19f5638734278f41adaa345e510f90d2 rename to explorer/fuzzing/fuzzer_corpus/d1e5a00347368e94959ff07b93e4c6a0762091a8 index 7ffa4b4393267..d9d195fc1b245 100644 --- a/explorer/fuzzing/fuzzer_corpus/d415017d19f5638734278f41adaa345e510f90d2 +++ b/explorer/fuzzing/fuzzer_corpus/d1e5a00347368e94959ff07b93e4c6a0762091a8 @@ -34,9 +34,9 @@ compilation_unit { members { function { name: "Convert" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { diff --git a/explorer/fuzzing/fuzzer_corpus/6feffd83f7b5bfd3f870e4365a8c0d58df0689b4 b/explorer/fuzzing/fuzzer_corpus/d438d10996b2ac3415accec527ba50adeda7a500 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/6feffd83f7b5bfd3f870e4365a8c0d58df0689b4 rename to explorer/fuzzing/fuzzer_corpus/d438d10996b2ac3415accec527ba50adeda7a500 index bc5316358f615..04b43fca2e0e3 100644 --- a/explorer/fuzzing/fuzzer_corpus/6feffd83f7b5bfd3f870e4365a8c0d58df0689b4 +++ b/explorer/fuzzing/fuzzer_corpus/d438d10996b2ac3415accec527ba50adeda7a500 @@ -9,9 +9,9 @@ compilation_unit { members { function { name: "F" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -77,9 +77,9 @@ compilation_unit { members { function { name: "F" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -130,7 +130,7 @@ compilation_unit { field: "n" object { identifier { - name: "me" + name: "self" } } } @@ -221,9 +221,9 @@ compilation_unit { members { function { name: "Convert" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -257,7 +257,7 @@ compilation_unit { field: "m" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/03db728d09b4ef55c73a6cf6c16bb6b7b53e3fc4 b/explorer/fuzzing/fuzzer_corpus/d4b10085400853e130d2f552d6493df76d33e24a similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/03db728d09b4ef55c73a6cf6c16bb6b7b53e3fc4 rename to explorer/fuzzing/fuzzer_corpus/d4b10085400853e130d2f552d6493df76d33e24a index 5dbb83c8d2ff7..62f745967ad2a 100644 --- a/explorer/fuzzing/fuzzer_corpus/03db728d09b4ef55c73a6cf6c16bb6b7b53e3fc4 +++ b/explorer/fuzzing/fuzzer_corpus/d4b10085400853e130d2f552d6493df76d33e24a @@ -64,9 +64,9 @@ compilation_unit { members { function { name: "Convert" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -101,7 +101,7 @@ compilation_unit { field: "v1" object { identifier { - name: "me" + name: "self" } } } @@ -111,7 +111,7 @@ compilation_unit { field: "v2" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/9ada7039985bcf2aeea353a2e74e93cfdc8b432e b/explorer/fuzzing/fuzzer_corpus/e18e54955a7d12d8676a628f6a8a2a700d09394d similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/9ada7039985bcf2aeea353a2e74e93cfdc8b432e rename to explorer/fuzzing/fuzzer_corpus/e18e54955a7d12d8676a628f6a8a2a700d09394d index e039dbce1a985..d9763925eebc0 100644 --- a/explorer/fuzzing/fuzzer_corpus/9ada7039985bcf2aeea353a2e74e93cfdc8b432e +++ b/explorer/fuzzing/fuzzer_corpus/e18e54955a7d12d8676a628f6a8a2a700d09394d @@ -21,9 +21,9 @@ compilation_unit { members { function { name: "G" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { diff --git a/explorer/fuzzing/fuzzer_corpus/5def149b950eae9d5fae3e3fadbdfc1e0d322cbc b/explorer/fuzzing/fuzzer_corpus/e3b3b1f52b6d35189726bae3b49d358f1eda35d6 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/5def149b950eae9d5fae3e3fadbdfc1e0d322cbc rename to explorer/fuzzing/fuzzer_corpus/e3b3b1f52b6d35189726bae3b49d358f1eda35d6 index 348a7ea864e88..72161017bdd9c 100644 --- a/explorer/fuzzing/fuzzer_corpus/5def149b950eae9d5fae3e3fadbdfc1e0d322cbc +++ b/explorer/fuzzing/fuzzer_corpus/e3b3b1f52b6d35189726bae3b49d358f1eda35d6 @@ -21,9 +21,9 @@ compilation_unit { members { function { name: "G" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { diff --git a/explorer/fuzzing/fuzzer_corpus/9a73b722edc48fc49e85c9221d5cdd6423f8f38a b/explorer/fuzzing/fuzzer_corpus/e6c980db2dc247d290d0bef72b045ddb3bc9e712 similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/9a73b722edc48fc49e85c9221d5cdd6423f8f38a rename to explorer/fuzzing/fuzzer_corpus/e6c980db2dc247d290d0bef72b045ddb3bc9e712 index f229e911d0b2a..113aa3266aa0a 100644 --- a/explorer/fuzzing/fuzzer_corpus/9a73b722edc48fc49e85c9221d5cdd6423f8f38a +++ b/explorer/fuzzing/fuzzer_corpus/e6c980db2dc247d290d0bef72b045ddb3bc9e712 @@ -50,9 +50,9 @@ compilation_unit { members { function { name: "GetX" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -81,7 +81,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -94,9 +94,9 @@ compilation_unit { members { function { name: "GetXY" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -137,7 +137,7 @@ compilation_unit { field: "GetX" object { identifier { - name: "me" + name: "self" } } } @@ -153,7 +153,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/8fa92df904a230ee4b0ecf1362170a2551aec98b b/explorer/fuzzing/fuzzer_corpus/eebcd02d851ed64b1185b3eaa0b4d23f49189e06 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/8fa92df904a230ee4b0ecf1362170a2551aec98b rename to explorer/fuzzing/fuzzer_corpus/eebcd02d851ed64b1185b3eaa0b4d23f49189e06 index 0abb7fb7c2f9f..2ab5bf2c3ce5f 100644 --- a/explorer/fuzzing/fuzzer_corpus/8fa92df904a230ee4b0ecf1362170a2551aec98b +++ b/explorer/fuzzing/fuzzer_corpus/eebcd02d851ed64b1185b3eaa0b4d23f49189e06 @@ -24,9 +24,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -67,9 +67,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -205,9 +205,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -258,7 +258,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -286,7 +286,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } @@ -314,9 +314,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -366,7 +366,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -389,7 +389,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/51a6ff8051dffb6bc7c57b437a526d8f1ed37a57 b/explorer/fuzzing/fuzzer_corpus/eeffdec7cdffe7258413447330e745427673be5b similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/51a6ff8051dffb6bc7c57b437a526d8f1ed37a57 rename to explorer/fuzzing/fuzzer_corpus/eeffdec7cdffe7258413447330e745427673be5b index a3aa89be00564..7d1cf6bd077d9 100644 --- a/explorer/fuzzing/fuzzer_corpus/51a6ff8051dffb6bc7c57b437a526d8f1ed37a57 +++ b/explorer/fuzzing/fuzzer_corpus/eeffdec7cdffe7258413447330e745427673be5b @@ -50,9 +50,9 @@ compilation_unit { members { function { name: "SetX" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { diff --git a/explorer/fuzzing/fuzzer_corpus/fc5f5e4f348579cedbecae8dccafc9f9dae68237 b/explorer/fuzzing/fuzzer_corpus/ef9e4ddee87e9a1551d2cf0f56c2b2698d6000c0 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/fc5f5e4f348579cedbecae8dccafc9f9dae68237 rename to explorer/fuzzing/fuzzer_corpus/ef9e4ddee87e9a1551d2cf0f56c2b2698d6000c0 index 7b789e3a426a1..addee7400731b 100644 --- a/explorer/fuzzing/fuzzer_corpus/fc5f5e4f348579cedbecae8dccafc9f9dae68237 +++ b/explorer/fuzzing/fuzzer_corpus/ef9e4ddee87e9a1551d2cf0f56c2b2698d6000c0 @@ -77,9 +77,9 @@ compilation_unit { members { function { name: "GetX" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -122,7 +122,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/522da9a0308eba58c432f7aa35e79b795467ca21 b/explorer/fuzzing/fuzzer_corpus/f2dfd518c2577c93096166bb98f1155256906d0b similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/522da9a0308eba58c432f7aa35e79b795467ca21 rename to explorer/fuzzing/fuzzer_corpus/f2dfd518c2577c93096166bb98f1155256906d0b index 1b8d829e9287f..4de446f7fd4d1 100644 --- a/explorer/fuzzing/fuzzer_corpus/522da9a0308eba58c432f7aa35e79b795467ca21 +++ b/explorer/fuzzing/fuzzer_corpus/f2dfd518c2577c93096166bb98f1155256906d0b @@ -9,9 +9,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -52,9 +52,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -149,9 +149,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -202,7 +202,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -230,7 +230,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/2584c688c48bb0fcc5f1b1f91292e0688e759cd0 b/explorer/fuzzing/fuzzer_corpus/f3efad50612502cd8b950bcac04915a6955c69bb similarity index 96% rename from explorer/fuzzing/fuzzer_corpus/2584c688c48bb0fcc5f1b1f91292e0688e759cd0 rename to explorer/fuzzing/fuzzer_corpus/f3efad50612502cd8b950bcac04915a6955c69bb index 30097390bc239..d412dbf2dc6c7 100644 --- a/explorer/fuzzing/fuzzer_corpus/2584c688c48bb0fcc5f1b1f91292e0688e759cd0 +++ b/explorer/fuzzing/fuzzer_corpus/f3efad50612502cd8b950bcac04915a6955c69bb @@ -9,9 +9,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -52,9 +52,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -151,9 +151,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -204,7 +204,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -232,7 +232,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } @@ -260,9 +260,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -312,7 +312,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -335,7 +335,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } @@ -373,9 +373,9 @@ compilation_unit { members { function { name: "Add" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -426,7 +426,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -454,7 +454,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } @@ -482,9 +482,9 @@ compilation_unit { members { function { name: "Scale" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -534,7 +534,7 @@ compilation_unit { field: "x" object { identifier { - name: "me" + name: "self" } } } @@ -557,7 +557,7 @@ compilation_unit { field: "y" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/65fd2bf8e57cee5e4dd1168a3ef1d46b352d1e61 b/explorer/fuzzing/fuzzer_corpus/f7e287c201224da259cfdf413438115348e5f54a similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/65fd2bf8e57cee5e4dd1168a3ef1d46b352d1e61 rename to explorer/fuzzing/fuzzer_corpus/f7e287c201224da259cfdf413438115348e5f54a index 985dcce4be90e..b163325cefd4e 100644 --- a/explorer/fuzzing/fuzzer_corpus/65fd2bf8e57cee5e4dd1168a3ef1d46b352d1e61 +++ b/explorer/fuzzing/fuzzer_corpus/f7e287c201224da259cfdf413438115348e5f54a @@ -34,9 +34,9 @@ compilation_unit { members { function { name: "Convert" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -105,9 +105,9 @@ compilation_unit { members { function { name: "Convert" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -176,9 +176,9 @@ compilation_unit { members { function { name: "Convert" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -207,7 +207,7 @@ compilation_unit { field: "n" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/713cf9469d63bd75c1e35014758c535d04427ac1 b/explorer/fuzzing/fuzzer_corpus/f7f6d87bd21a9da0681c8728d40a6fd62dcd9ea7 similarity index 98% rename from explorer/fuzzing/fuzzer_corpus/713cf9469d63bd75c1e35014758c535d04427ac1 rename to explorer/fuzzing/fuzzer_corpus/f7f6d87bd21a9da0681c8728d40a6fd62dcd9ea7 index 92e41e0b2d9b4..7d38cdaed44d6 100644 --- a/explorer/fuzzing/fuzzer_corpus/713cf9469d63bd75c1e35014758c535d04427ac1 +++ b/explorer/fuzzing/fuzzer_corpus/f7f6d87bd21a9da0681c8728d40a6fd62dcd9ea7 @@ -9,9 +9,9 @@ compilation_unit { members { function { name: "F" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -77,9 +77,9 @@ compilation_unit { members { function { name: "F" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { @@ -130,7 +130,7 @@ compilation_unit { field: "n" object { identifier { - name: "me" + name: "self" } } } diff --git a/explorer/fuzzing/fuzzer_corpus/4ee491109d08f78764e3ed9a59f36521e348650b b/explorer/fuzzing/fuzzer_corpus/fcbce51b08fb96910190bccab95620d12d64e5e2 similarity index 97% rename from explorer/fuzzing/fuzzer_corpus/4ee491109d08f78764e3ed9a59f36521e348650b rename to explorer/fuzzing/fuzzer_corpus/fcbce51b08fb96910190bccab95620d12d64e5e2 index 7af3c68e5e740..238b9be313153 100644 --- a/explorer/fuzzing/fuzzer_corpus/4ee491109d08f78764e3ed9a59f36521e348650b +++ b/explorer/fuzzing/fuzzer_corpus/fcbce51b08fb96910190bccab95620d12d64e5e2 @@ -21,9 +21,9 @@ compilation_unit { members { function { name: "G" - me_pattern { + self_pattern { binding_pattern { - name: "me" + name: "self" type { expression_pattern { expression { diff --git a/explorer/interpreter/impl_scope.h b/explorer/interpreter/impl_scope.h index 60fbd0ffa96e6..c947c77a76e41 100644 --- a/explorer/interpreter/impl_scope.h +++ b/explorer/interpreter/impl_scope.h @@ -25,11 +25,11 @@ class InterfaceType; // // class C(U:! Type, T:! Type) { // class D(V:! Type where U is Fooable(T)) { -// fn bar[me: Self](x: U, y : T) -> T{ +// fn bar[self: Self](x: U, y : T) -> T{ // return x.foo(y) // } // } -// fn baz[me: Self](x: U, y : T) -> T { +// fn baz[self: Self](x: U, y : T) -> T { // return x.foo(y); // } // } diff --git a/explorer/interpreter/interpreter.cpp b/explorer/interpreter/interpreter.cpp index 57abc415a915f..46be20b40fd4e 100644 --- a/explorer/interpreter/interpreter.cpp +++ b/explorer/interpreter/interpreter.cpp @@ -684,8 +684,8 @@ auto Interpreter::CallFunction(const CallExpression& call, call.source_loc())); RuntimeScope method_scope(&heap_); BindingMap generic_args; - // Bind the receiver to the `me` parameter. - CARBON_CHECK(PatternMatch(&method.me_pattern().value(), m.receiver(), + // Bind the receiver to the `self` parameter. + CARBON_CHECK(PatternMatch(&method.self_pattern().value(), m.receiver(), call.source_loc(), &method_scope, generic_args, trace_stream_, this->arena_)); // Bind the arguments to the parameters. diff --git a/explorer/interpreter/resolve_names.cpp b/explorer/interpreter/resolve_names.cpp index a9e3e7fa3487b..e0056e435805a 100644 --- a/explorer/interpreter/resolve_names.cpp +++ b/explorer/interpreter/resolve_names.cpp @@ -508,7 +508,7 @@ static auto ResolveNames(Declaration& declaration, StaticScope& enclosing_scope, } if (function.is_method()) { CARBON_RETURN_IF_ERROR( - ResolveNames(function.me_pattern(), function_scope)); + ResolveNames(function.self_pattern(), function_scope)); } CARBON_RETURN_IF_ERROR( ResolveNames(function.param_pattern(), function_scope)); diff --git a/explorer/interpreter/type_checker.cpp b/explorer/interpreter/type_checker.cpp index 7bcb71369cf54..b669b496bc8d4 100644 --- a/explorer/interpreter/type_checker.cpp +++ b/explorer/interpreter/type_checker.cpp @@ -1465,12 +1465,13 @@ auto TypeChecker::TypeCheckExp(Nonnull e, break; case DeclarationKind::FunctionDeclaration: { auto func_decl = cast(*member); - if (func_decl->is_method() && func_decl->me_pattern().kind() == - PatternKind::AddrPattern) { + if (func_decl->is_method() && + func_decl->self_pattern().kind() == + PatternKind::AddrPattern) { access.set_is_field_addr_me_method(); Nonnull me_type = Substitute(t_class.type_args(), - &func_decl->me_pattern().static_type()); + &func_decl->self_pattern().static_type()); CARBON_RETURN_IF_ERROR(ExpectType( e->source_loc(), "method access, receiver type", me_type, &access.object().static_type(), &impl_scope)); @@ -2786,9 +2787,9 @@ auto TypeChecker::DeclareFunctionDeclaration(Nonnull f, // Type check the receiver pattern. if (f->is_method()) { CARBON_RETURN_IF_ERROR(TypeCheckPattern( - &f->me_pattern(), std::nullopt, function_scope, ValueCategory::Let)); - CollectGenericBindingsInPattern(&f->me_pattern(), deduced_bindings); - CollectImplBindingsInPattern(&f->me_pattern(), impl_bindings); + &f->self_pattern(), std::nullopt, function_scope, ValueCategory::Let)); + CollectGenericBindingsInPattern(&f->self_pattern(), deduced_bindings); + CollectImplBindingsInPattern(&f->self_pattern(), impl_bindings); } // Type check the parameter pattern. CARBON_RETURN_IF_ERROR(TypeCheckPattern(&f->param_pattern(), std::nullopt, diff --git a/explorer/interpreter/value.h b/explorer/interpreter/value.h index 0f381f7f20726..6c9a11671209c 100644 --- a/explorer/interpreter/value.h +++ b/explorer/interpreter/value.h @@ -85,7 +85,7 @@ class Value { LLVM_DUMP_METHOD void Dump() const { Print(llvm::errs()); } // Returns the sub-Value specified by `path`, which must be a valid field - // path for *this. If the sub-Value is a method and its me_pattern is an + // path for *this. If the sub-Value is a method and its self_pattern is an // AddrPattern, then pass the LValue representing the receiver as `me_value`, // otherwise pass `*this`. auto GetMember(Nonnull arena, const FieldPath& path, diff --git a/explorer/testdata/addr/fail-method-let.carbon b/explorer/testdata/addr/fail-method-let.carbon index 5d6866d9f6514..73d640eb04e73 100644 --- a/explorer/testdata/addr/fail-method-let.carbon +++ b/explorer/testdata/addr/fail-method-let.carbon @@ -16,9 +16,9 @@ class Point { return {.x = 0, .y = 0}; } - fn GetSetX[addr me: Point*](x: i32) -> i32 { - var old: auto = (*me).x; - (*me).x = x; + fn GetSetX[addr self: Point*](x: i32) -> i32 { + var old: auto = (*self).x; + (*self).x = x; return old; } diff --git a/explorer/testdata/addr/fail-method-me-type.carbon b/explorer/testdata/addr/fail-method-self-type.carbon similarity index 77% rename from explorer/testdata/addr/fail-method-me-type.carbon rename to explorer/testdata/addr/fail-method-self-type.carbon index 3babe10f6a838..835deaf13dc41 100644 --- a/explorer/testdata/addr/fail-method-me-type.carbon +++ b/explorer/testdata/addr/fail-method-self-type.carbon @@ -20,9 +20,9 @@ class Point { return {.x = 0, .y = 0}; } - fn GetSetX[addr me: Shape*](x: i32) -> i32 { - var old: auto = (*me).x; - (*me).x = x; + fn GetSetX[addr self: Shape*](x: i32) -> i32 { + var old: auto = (*self).x; + (*self).x = x; return old; } @@ -32,7 +32,7 @@ class Point { fn Main() -> i32 { var p: Point = Point.Origin(); - // CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/addr/fail-method-me-type.carbon:[[@LINE+1]]: type error in method access, receiver type: 'class Point' is not implicitly convertible to 'class Shape' + // CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/addr/fail-method-self-type.carbon:[[@LINE+1]]: type error in method access, receiver type: 'class Point' is not implicitly convertible to 'class Shape' var x: auto = p.GetSetX(42); if (p.x == 42) { return x; diff --git a/explorer/testdata/addr/method.carbon b/explorer/testdata/addr/method.carbon index c1e70582e0700..8bf0052e0c713 100644 --- a/explorer/testdata/addr/method.carbon +++ b/explorer/testdata/addr/method.carbon @@ -17,9 +17,9 @@ class Point { return {.x = 0, .y = 0}; } - fn GetSetX[addr me: Point*](x: i32) -> i32 { - var old: auto = (*me).x; - (*me).x = x; + fn GetSetX[addr self: Point*](x: i32) -> i32 { + var old: auto = (*self).x; + (*self).x = x; return old; } diff --git a/explorer/testdata/addr/nested-method.carbon b/explorer/testdata/addr/nested-method.carbon index cf35a423246ef..6609a19a963b9 100644 --- a/explorer/testdata/addr/nested-method.carbon +++ b/explorer/testdata/addr/nested-method.carbon @@ -15,9 +15,9 @@ package ExplorerTest api; class B { var x: i32; - fn GetSetX[addr me: Self*](x: i32) -> i32 { - var oldX: auto = (*me).x; - (*me).x = x; + fn GetSetX[addr self: Self*](x: i32) -> i32 { + var oldX: auto = (*self).x; + (*self).x = x; return oldX; } } diff --git a/explorer/testdata/alias/class_alias.carbon b/explorer/testdata/alias/class_alias.carbon index 624b6921767ab..6b9dbffc8711f 100644 --- a/explorer/testdata/alias/class_alias.carbon +++ b/explorer/testdata/alias/class_alias.carbon @@ -12,16 +12,16 @@ package ExplorerTest api; interface Addable { - fn Add[me: Self](k: i32) -> Self; + fn Add[self: Self](k: i32) -> Self; } impl i32 as Addable { - fn Add[me: Self](k: i32) -> Self { return me + k; } + fn Add[self: Self](k: i32) -> Self { return self + k; } } class Class { var n: i32; } class GenericClass(T:! Addable) { var m: T; - fn Get[me: Self](n: i32) -> T { return me.m.Add(n); } + fn Get[self: Self](n: i32) -> T { return self.m.Add(n); } } alias ClassAlias = Class; diff --git a/explorer/testdata/alias/member_name_alias.carbon b/explorer/testdata/alias/member_name_alias.carbon index f6da101a1a7ae..7b96c48483389 100644 --- a/explorer/testdata/alias/member_name_alias.carbon +++ b/explorer/testdata/alias/member_name_alias.carbon @@ -13,19 +13,19 @@ package ExplorerTest api; interface I { fn F() -> i32; - fn M[me: Self]() -> i32; + fn M[self: Self]() -> i32; } class A { var n: i32; impl as I { fn F() -> i32 { return 1; } - fn M[me: Self]() -> i32 { return 2; } + fn M[self: Self]() -> i32 { return 2; } } - fn G[me: Self]() -> i32 { return 3; } + fn G[self: Self]() -> i32 { return 3; } } impl i32 as I { fn F() -> i32 { return 4; } - fn M[me: Self]() -> i32 { return 5; } + fn M[self: Self]() -> i32 { return 5; } } alias IF = I.F; diff --git a/explorer/testdata/assign/convert_rhs.carbon b/explorer/testdata/assign/convert_rhs.carbon index 2bdd5b5ef9f99..87c37f32aa90a 100644 --- a/explorer/testdata/assign/convert_rhs.carbon +++ b/explorer/testdata/assign/convert_rhs.carbon @@ -15,7 +15,7 @@ class A { var n: i32; } impl i32 as ImplicitAs(A) { - fn Convert[me: Self]() -> A { return {.n = me }; } + fn Convert[self: Self]() -> A { return {.n = self }; } } fn Main() -> i32 { diff --git a/explorer/testdata/class/bound_method.carbon b/explorer/testdata/class/bound_method.carbon index 0d73ebed84eb3..c6f9e1d351120 100644 --- a/explorer/testdata/class/bound_method.carbon +++ b/explorer/testdata/class/bound_method.carbon @@ -15,8 +15,8 @@ class Point { fn Origin() -> Point { return {.x = 0, .y = 0}; } - fn GetX[me: Point]() -> i32 { - return me.x; + fn GetX[self: Point]() -> i32 { + return self.x; } var x: i32; var y: i32; diff --git a/explorer/testdata/class/empty_class.carbon b/explorer/testdata/class/empty_class.carbon index 3133a683c777c..313a6ce00c9ff 100644 --- a/explorer/testdata/class/empty_class.carbon +++ b/explorer/testdata/class/empty_class.carbon @@ -11,7 +11,7 @@ package ExplorerTest api; -class A { fn F[me: Self]() -> i32 { return 0; } } +class A { fn F[self: Self]() -> i32 { return 0; } } fn Main() -> i32 { // {} is a bit strange; its type is {}. Make sure we can properly convert a diff --git a/explorer/testdata/class/fail_method_deduced.carbon b/explorer/testdata/class/fail_method_deduced.carbon index f011182006db8..96b410db9e2c3 100644 --- a/explorer/testdata/class/fail_method_deduced.carbon +++ b/explorer/testdata/class/fail_method_deduced.carbon @@ -12,7 +12,7 @@ package ExplorerTest api; class C { fn F() {} - fn G[me: Self]() {} + fn G[self: Self]() {} } fn H[T:! Type](x: T) {} diff --git a/explorer/testdata/class/fail_method_from_class.carbon b/explorer/testdata/class/fail_method_from_class.carbon index 414747b9f08ea..78c6a9ae08061 100644 --- a/explorer/testdata/class/fail_method_from_class.carbon +++ b/explorer/testdata/class/fail_method_from_class.carbon @@ -15,8 +15,8 @@ class Point { return {.x = 0, .y = 0}; } - fn GetX[me: Point]() -> i32 { - return me.x; + fn GetX[self: Point]() -> i32 { + return self.x; } var x: i32; diff --git a/explorer/testdata/class/fail_method_in_var.carbon b/explorer/testdata/class/fail_method_in_var.carbon index 58cfdfd42bbfa..739de304c18b0 100644 --- a/explorer/testdata/class/fail_method_in_var.carbon +++ b/explorer/testdata/class/fail_method_in_var.carbon @@ -12,7 +12,7 @@ package ExplorerTest api; class C { fn F() {} - fn G[me: Self]() {} + fn G[self: Self]() {} } fn Main() -> i32 { diff --git a/explorer/testdata/class/fail_return_method.carbon b/explorer/testdata/class/fail_return_method.carbon index ef6e05ecf0134..1ae204945d60e 100644 --- a/explorer/testdata/class/fail_return_method.carbon +++ b/explorer/testdata/class/fail_return_method.carbon @@ -12,7 +12,7 @@ package ExplorerTest api; class C { fn F() {} - fn G[me: Self]() {} + fn G[self: Self]() {} } fn ReturnF() -> auto { return C.F; } diff --git a/explorer/testdata/class/method.carbon b/explorer/testdata/class/method.carbon index 64871158213b2..5cfa6cf73e954 100644 --- a/explorer/testdata/class/method.carbon +++ b/explorer/testdata/class/method.carbon @@ -16,8 +16,8 @@ class Point { return {.x = 0, .y = 0}; } - fn GetX[me: Point]() -> i32 { - return me.x; + fn GetX[self: Point]() -> i32 { + return self.x; } var x: i32; diff --git a/explorer/testdata/class/method_call_method.carbon b/explorer/testdata/class/method_call_method.carbon index dd72eb81846e1..2c90363446d4a 100644 --- a/explorer/testdata/class/method_call_method.carbon +++ b/explorer/testdata/class/method_call_method.carbon @@ -16,12 +16,12 @@ class Point { return {.x = 0, .y = 0}; } - fn GetX[me: Point]() -> i32 { - return me.x; + fn GetX[self: Point]() -> i32 { + return self.x; } - fn GetXY[me: Point]() -> (i32, i32) { - return (me.GetX(), me.y); + fn GetXY[self: Point]() -> (i32, i32) { + return (self.GetX(), self.y); } var x: i32; diff --git a/explorer/testdata/class/method_self.carbon b/explorer/testdata/class/method_self.carbon index af7a184e0aaa2..2e5ca84c8e35c 100644 --- a/explorer/testdata/class/method_self.carbon +++ b/explorer/testdata/class/method_self.carbon @@ -17,8 +17,8 @@ class Point { } // Allowed: `Self` here means `Point`. - fn GetX[me: Self]() -> i32 { - return me.x; + fn GetX[self: Self]() -> i32 { + return self.x; } var x: i32; diff --git a/explorer/testdata/constraint/binding_self.carbon b/explorer/testdata/constraint/binding_self.carbon index 3ef0e6c2040cd..bb7473d794ca3 100644 --- a/explorer/testdata/constraint/binding_self.carbon +++ b/explorer/testdata/constraint/binding_self.carbon @@ -12,11 +12,11 @@ package ExplorerTest api; interface SwizzleWith(T:! Type) { - fn Op[me: Self](x: T) -> i32; + fn Op[self: Self](x: T) -> i32; } impl i32 as SwizzleWith(i32) { - fn Op[me: Self](x: Self) -> Self { return me * 10 + x; } + fn Op[self: Self](x: Self) -> Self { return self * 10 + x; } } fn F[T:! SwizzleWith(.Self)](v: T, w: T) -> i32 { diff --git a/explorer/testdata/constraint/where_self.carbon b/explorer/testdata/constraint/where_self.carbon index 3abf0d78ef6cf..14b2e506231cc 100644 --- a/explorer/testdata/constraint/where_self.carbon +++ b/explorer/testdata/constraint/where_self.carbon @@ -12,7 +12,7 @@ package ExplorerTest api; interface SwizzleWith(T:! Type) { - fn Op[me: Self](x: T) -> i32; + fn Op[self: Self](x: T) -> i32; } // TODO: There should be some way to write this that includes @@ -20,7 +20,7 @@ interface SwizzleWith(T:! Type) { alias Swizzle = Type where .Self is SwizzleWith(.Self); impl i32 as SwizzleWith(i32) { - fn Op[me: Self](x: Self) -> Self { return me * 10 + x; } + fn Op[self: Self](x: Self) -> Self { return self * 10 + x; } } fn F[T:! Swizzle](v: T, w: T) -> i32 { diff --git a/explorer/testdata/experimental_continuation/convert_run.carbon b/explorer/testdata/experimental_continuation/convert_run.carbon index c3a08f2c9fec2..24ab7f81b42ac 100644 --- a/explorer/testdata/experimental_continuation/convert_run.carbon +++ b/explorer/testdata/experimental_continuation/convert_run.carbon @@ -17,8 +17,8 @@ class Wrap(T:! Type) { fn MakeWrap[T:! Type](x: T) -> Wrap(T) { return {.v = x}; } impl forall [T:! Type] Wrap(T) as ImplicitAs(T) { - fn Convert[me: Self]() -> T { - return me.v; + fn Convert[self: Self]() -> T { + return self.v; } } diff --git a/explorer/testdata/function/convert_args.carbon b/explorer/testdata/function/convert_args.carbon index 9b094843edfbd..5802f7329e6f7 100644 --- a/explorer/testdata/function/convert_args.carbon +++ b/explorer/testdata/function/convert_args.carbon @@ -13,19 +13,19 @@ package ExplorerTest api; class One { impl One as ImplicitAs(i32) { - fn Convert[me: Self]() -> i32 { return 1; } + fn Convert[self: Self]() -> i32 { return 1; } } } class Two { impl Two as ImplicitAs(i32) { - fn Convert[me: Self]() -> i32 { return 2; } + fn Convert[self: Self]() -> i32 { return 2; } } } class N { impl N as ImplicitAs(i32) { - fn Convert[me: Self]() -> i32 { return me.n; } + fn Convert[self: Self]() -> i32 { return self.n; } } var n: i32; } diff --git a/explorer/testdata/generic_class/class_function.carbon b/explorer/testdata/generic_class/class_function.carbon index 49017109bf7bc..d798b2f31bbd7 100644 --- a/explorer/testdata/generic_class/class_function.carbon +++ b/explorer/testdata/generic_class/class_function.carbon @@ -13,7 +13,7 @@ package ExplorerTest api; interface Number { fn Zero() -> Self; - fn Add[me: Self](other: Self) -> Self; + fn Add[self: Self](other: Self) -> Self; } class Point(T:! Number) { @@ -32,7 +32,7 @@ class Point(T:! Number) { external impl i32 as Number { fn Zero() -> i32 { return 0; } - fn Add[me: i32](other: i32) -> i32 { return me + other; } + fn Add[self: i32](other: i32) -> i32 { return self + other; } } fn Main() -> i32 { diff --git a/explorer/testdata/generic_class/fail_args_mismatch.carbon b/explorer/testdata/generic_class/fail_args_mismatch.carbon index 62eca4c7ae75f..6dd84c0bd891b 100644 --- a/explorer/testdata/generic_class/fail_args_mismatch.carbon +++ b/explorer/testdata/generic_class/fail_args_mismatch.carbon @@ -15,8 +15,8 @@ class Point(T:! Type) { return {.x = zero, .y = zero}; } - fn GetX[me: Point(T, T)]() -> T { - return me.x; + fn GetX[self: Point(T, T)]() -> T { + return self.x; } var x: T; diff --git a/explorer/testdata/generic_class/fail_bad_parameter_type.carbon b/explorer/testdata/generic_class/fail_bad_parameter_type.carbon index 03839182c87ab..e74da653750e3 100644 --- a/explorer/testdata/generic_class/fail_bad_parameter_type.carbon +++ b/explorer/testdata/generic_class/fail_bad_parameter_type.carbon @@ -15,8 +15,8 @@ class Point(T:! i32) { return {.x = zero, .y = zero}; } - fn GetX[me: Point(T)]() -> T { - return me.x; + fn GetX[self: Point(T)]() -> T { + return self.x; } var x: T; diff --git a/explorer/testdata/generic_class/fail_no_args.carbon b/explorer/testdata/generic_class/fail_no_args.carbon index b737d1c7ccdd4..cc85c5609ea11 100644 --- a/explorer/testdata/generic_class/fail_no_args.carbon +++ b/explorer/testdata/generic_class/fail_no_args.carbon @@ -17,8 +17,8 @@ class Point(T:! Type) { // Error: wrote `Point` instead of `Point(T)`, `Point` by itself is not a type. // CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_class/fail_no_args.carbon:[[@LINE+1]]: Expected a type, but got Point - fn GetX[me: Point]() -> T { - return me.x; + fn GetX[self: Point]() -> T { + return self.x; } var x: T; diff --git a/explorer/testdata/generic_class/fail_self_with_arg.carbon b/explorer/testdata/generic_class/fail_self_with_arg.carbon index 44600e9081d61..200747961265c 100644 --- a/explorer/testdata/generic_class/fail_self_with_arg.carbon +++ b/explorer/testdata/generic_class/fail_self_with_arg.carbon @@ -19,8 +19,8 @@ class Point(T:! Type) { } // Error: wrote `Self(T)` instead of `Self`. - fn GetX[me: Self(T)]() -> T { - return me.x; + fn GetX[self: Self(T)]() -> T { + return self.x; } var x: T; diff --git a/explorer/testdata/generic_class/fail_two_arg_lists.carbon b/explorer/testdata/generic_class/fail_two_arg_lists.carbon index 262785406274b..5490dd21547c4 100644 --- a/explorer/testdata/generic_class/fail_two_arg_lists.carbon +++ b/explorer/testdata/generic_class/fail_two_arg_lists.carbon @@ -16,8 +16,8 @@ class Point(T:! Type) { return {.x = zero, .y = zero}; } - fn GetX[me: Point(T)(T)]() -> T { - return me.x; + fn GetX[self: Point(T)(T)]() -> T { + return self.x; } var x: T; diff --git a/explorer/testdata/generic_class/generic_class_substitution.carbon b/explorer/testdata/generic_class/generic_class_substitution.carbon index bf22c5a61cc34..d01bf2d82678f 100644 --- a/explorer/testdata/generic_class/generic_class_substitution.carbon +++ b/explorer/testdata/generic_class/generic_class_substitution.carbon @@ -13,7 +13,7 @@ package ExplorerTest api; interface Number { fn Zero() -> Self; - fn Add[me: Self](other: Self) -> Self; + fn Add[self: Self](other: Self) -> Self; } class Point(T:! Number) { @@ -26,7 +26,7 @@ class Point(T:! Number) { external impl i32 as Number { fn Zero() -> i32 { return 0; } - fn Add[me: i32](other: i32) -> i32 { return me + other; } + fn Add[self: i32](other: i32) -> i32 { return self + other; } } fn SumXY[U:! Number](p: Point(U)) -> U { diff --git a/explorer/testdata/generic_class/generic_fun_and_class.carbon b/explorer/testdata/generic_class/generic_fun_and_class.carbon index f62ea7a54e2ef..63ce01a6d7442 100644 --- a/explorer/testdata/generic_class/generic_fun_and_class.carbon +++ b/explorer/testdata/generic_class/generic_fun_and_class.carbon @@ -13,7 +13,7 @@ package ExplorerTest api; interface Number { fn Zero() -> Self; - fn Add[me: Self](other: Self) -> Self; + fn Add[self: Self](other: Self) -> Self; } class Point(T:! Number) { @@ -35,7 +35,7 @@ fn SumXY[U :! Number](other: Point(U)) -> U { external impl i32 as Number { fn Zero() -> i32 { return 0; } - fn Add[me: i32](other: i32) -> i32 { return me + other; } + fn Add[self: i32](other: i32) -> i32 { return self + other; } } fn Main() -> i32 { diff --git a/explorer/testdata/generic_class/generic_point.carbon b/explorer/testdata/generic_class/generic_point.carbon index 58d39d257aa62..a4d8756853650 100644 --- a/explorer/testdata/generic_class/generic_point.carbon +++ b/explorer/testdata/generic_class/generic_point.carbon @@ -16,8 +16,8 @@ class Point(T:! Type) { return {.x = zero, .y = zero}; } - fn GetX[me: Point(T)]() -> T { - return me.x; + fn GetX[self: Point(T)]() -> T { + return self.x; } var x: T; diff --git a/explorer/testdata/generic_class/impl_with_argument.carbon b/explorer/testdata/generic_class/impl_with_argument.carbon index 6bef60e3ebb3a..48fc8e353c628 100644 --- a/explorer/testdata/generic_class/impl_with_argument.carbon +++ b/explorer/testdata/generic_class/impl_with_argument.carbon @@ -13,8 +13,8 @@ package ExplorerTest api; interface Vector { fn Zero() -> Self; - fn Add[me: Self](b: Self) -> Self; - fn Scale[me: Self](v: i32) -> Self; + fn Add[self: Self](b: Self) -> Self; + fn Scale[self: Self](v: i32) -> Self; } class Point(T:! Type) { @@ -28,12 +28,12 @@ external impl Point(i32) as Vector { return {.x = 0, .y = 0}; } - fn Add[me: Point(i32)](b: Point(i32)) -> Point(i32) { - return {.x = me.x + b.x, .y = me.y + b.y}; + fn Add[self: Point(i32)](b: Point(i32)) -> Point(i32) { + return {.x = self.x + b.x, .y = self.y + b.y}; } - fn Scale[me: Point(i32)](v: i32) -> Point(i32) { - return {.x = me.x * v, .y = me.y * v}; + fn Scale[self: Point(i32)](v: i32) -> Point(i32) { + return {.x = self.x * v, .y = self.y * v}; } } diff --git a/explorer/testdata/generic_class/impl_with_self.carbon b/explorer/testdata/generic_class/impl_with_self.carbon index edfa65b6e7ccf..23a6b17830eba 100644 --- a/explorer/testdata/generic_class/impl_with_self.carbon +++ b/explorer/testdata/generic_class/impl_with_self.carbon @@ -13,8 +13,8 @@ package ExplorerTest api; interface Vector { fn Zero() -> Self; - fn Add[me: Self](b: Self) -> Self; - fn Scale[me: Self](v: i32) -> Self; + fn Add[self: Self](b: Self) -> Self; + fn Scale[self: Self](v: i32) -> Self; } class Point(T:! Type) { @@ -28,12 +28,12 @@ external impl Point(i32) as Vector { return {.x = 0, .y = 0}; } - fn Add[me: Self](b: Self) -> Self { - return {.x = me.x + b.x, .y = me.y + b.y}; + fn Add[self: Self](b: Self) -> Self { + return {.x = self.x + b.x, .y = self.y + b.y}; } - fn Scale[me: Self](v: i32) -> Self { - return {.x = me.x * v, .y = me.y * v}; + fn Scale[self: Self](v: i32) -> Self { + return {.x = self.x * v, .y = self.y * v}; } } diff --git a/explorer/testdata/generic_class/param_with_dependent_type.carbon b/explorer/testdata/generic_class/param_with_dependent_type.carbon index 12b1cab95ae4e..da18f416b9306 100644 --- a/explorer/testdata/generic_class/param_with_dependent_type.carbon +++ b/explorer/testdata/generic_class/param_with_dependent_type.carbon @@ -12,7 +12,7 @@ package ExplorerTest api; class Point(T:! Type, V:! T) { - fn Get[me: Self]() -> T { + fn Get[self: Self]() -> T { return V; } } diff --git a/explorer/testdata/generic_class/point_with_interface.carbon b/explorer/testdata/generic_class/point_with_interface.carbon index 948cda25954fc..fda5871dff542 100644 --- a/explorer/testdata/generic_class/point_with_interface.carbon +++ b/explorer/testdata/generic_class/point_with_interface.carbon @@ -13,18 +13,18 @@ package ExplorerTest api; interface Number { fn Zero() -> Self; - fn Add[me: Self](other: Self) -> Self; + fn Add[self: Self](other: Self) -> Self; } class Point(T:! Number) { fn Origin() -> Point(T) { return {.x = T.Zero(), .y = T.Zero()}; } - fn Clone[me: Point(T)]() -> Point(T) { - return {.x = me.x, .y = me.y}; + fn Clone[self: Point(T)]() -> Point(T) { + return {.x = self.x, .y = self.y}; } - fn SumXY[me: Point(T)]() -> T { - return me.x.Add(me.y); + fn SumXY[self: Point(T)]() -> T { + return self.x.Add(self.y); } var x: T; var y: T; @@ -32,7 +32,7 @@ class Point(T:! Number) { external impl i32 as Number { fn Zero() -> i32 { return 0; } - fn Add[me: i32](other: i32) -> i32 { return me + other; } + fn Add[self: i32](other: i32) -> i32 { return self + other; } } fn Main() -> i32 { diff --git a/explorer/testdata/generic_class/use_self.carbon b/explorer/testdata/generic_class/use_self.carbon index 9f7544d59a250..9985fb1ea8a74 100644 --- a/explorer/testdata/generic_class/use_self.carbon +++ b/explorer/testdata/generic_class/use_self.carbon @@ -17,8 +17,8 @@ class Point(T:! Type) { return {.x = zero, .y = zero}; } - fn GetX[me: Self]() -> T { - return me.x; + fn GetX[self: Self]() -> T { + return self.x; } var x: T; diff --git a/explorer/testdata/generic_function/generic_method.carbon b/explorer/testdata/generic_function/generic_method.carbon index 9733f93403214..110a1c56a4cfa 100644 --- a/explorer/testdata/generic_function/generic_method.carbon +++ b/explorer/testdata/generic_function/generic_method.carbon @@ -14,13 +14,13 @@ package ExplorerTest api; class Cell(T:! Type) { fn Create(x: T) -> Cell(T) { return { .data = x }; } - fn Get[me: Self]() -> T { - return me.data; + fn Get[self: Self]() -> T { + return self.data; } - fn Put[addr me: Self*](x: T) { - (*me).data = x; + fn Put[addr self: Self*](x: T) { + (*self).data = x; } - fn CreateOther[me: Self, U:! Type](x: U) -> Cell(U) { + fn CreateOther[self: Self, U:! Type](x: U) -> Cell(U) { return {.data = x}; } var data: T; @@ -31,7 +31,7 @@ class Integer { } impl Integer as ImplicitAs(Integer) { - fn Convert[me: Self]() -> Integer { return me; } + fn Convert[self: Self]() -> Integer { return self; } } fn Main() -> i32 { diff --git a/explorer/testdata/generic_function/implicit_conversion.carbon b/explorer/testdata/generic_function/implicit_conversion.carbon index ad6ee0025e8e2..e08ca3a1e2283 100644 --- a/explorer/testdata/generic_function/implicit_conversion.carbon +++ b/explorer/testdata/generic_function/implicit_conversion.carbon @@ -12,10 +12,10 @@ package ExplorerTest api; interface IntLike { - fn Convert[me: Self]() -> i32; + fn Convert[self: Self]() -> i32; } impl i32 as IntLike { - fn Convert[me: i32]() -> i32 { return me; } + fn Convert[self: i32]() -> i32 { return self; } } fn add[T:! IntLike](x: {.a: T, .b: ({.m: i32, .n: T}, i32)}) -> i32 { diff --git a/explorer/testdata/global_variable/implicit_conversion.carbon b/explorer/testdata/global_variable/implicit_conversion.carbon index 7114330d90588..89998f28134b2 100644 --- a/explorer/testdata/global_variable/implicit_conversion.carbon +++ b/explorer/testdata/global_variable/implicit_conversion.carbon @@ -15,7 +15,7 @@ class A { var n: i32; } impl i32 as ImplicitAs(A) { - fn Convert[me: Self]() -> A { return {.n = me}; } + fn Convert[self: Self]() -> A { return {.n = self}; } } var a: A = 5; diff --git a/explorer/testdata/if_else/convert_condition.carbon b/explorer/testdata/if_else/convert_condition.carbon index 44c8d7e160e80..2f64880373a03 100644 --- a/explorer/testdata/if_else/convert_condition.carbon +++ b/explorer/testdata/if_else/convert_condition.carbon @@ -15,8 +15,8 @@ class LazyEq { var v1: i32; var v2: i32; impl as ImplicitAs(Bool) { - fn Convert[me: Self]() -> Bool { - return me.v1 == me.v2; + fn Convert[self: Self]() -> Bool { + return self.v1 == self.v2; } } fn Make(v1: i32, v2: i32) -> Self { diff --git a/explorer/testdata/if_expression/convert_condition.carbon b/explorer/testdata/if_expression/convert_condition.carbon index 34c0337747bcc..c9f3b4610d4dd 100644 --- a/explorer/testdata/if_expression/convert_condition.carbon +++ b/explorer/testdata/if_expression/convert_condition.carbon @@ -15,8 +15,8 @@ class LazyEq { var v1: i32; var v2: i32; impl as ImplicitAs(Bool) { - fn Convert[me: Self]() -> Bool { - return me.v1 == me.v2; + fn Convert[self: Self]() -> Bool { + return self.v1 == self.v2; } } fn Make(v1: i32, v2: i32) -> Self { diff --git a/explorer/testdata/impl/fail_ambiguous_impl.carbon b/explorer/testdata/impl/fail_ambiguous_impl.carbon index 3a21ceda258e6..fb6eec6e9f671 100644 --- a/explorer/testdata/impl/fail_ambiguous_impl.carbon +++ b/explorer/testdata/impl/fail_ambiguous_impl.carbon @@ -12,8 +12,8 @@ package ExplorerTest api; interface Vector { - fn Add[me: Self](b: Self) -> Self; - fn Scale[me: Self](v: i32) -> Self; + fn Add[self: Self](b: Self) -> Self; + fn Scale[self: Self](v: i32) -> Self; } class Point { @@ -22,20 +22,20 @@ class Point { } external impl Point as Vector { - fn Add[me: Point](b: Point) -> Point { - return {.x = me.x + b.x, .y = me.y + b.y}; + fn Add[self: Point](b: Point) -> Point { + return {.x = self.x + b.x, .y = self.y + b.y}; } - fn Scale[me: Point](v: i32) -> Point { - return {.x = me.x * v, .y = me.y * v}; + fn Scale[self: Point](v: i32) -> Point { + return {.x = self.x * v, .y = self.y * v}; } } external impl Point as Vector { - fn Add[me: Point](b: Point) -> Point { - return {.x = me.x + b.x, .y = me.y + b.y}; + fn Add[self: Point](b: Point) -> Point { + return {.x = self.x + b.x, .y = self.y + b.y}; } - fn Scale[me: Point](v: i32) -> Point { - return {.x = me.x * v, .y = me.y * v}; + fn Scale[self: Point](v: i32) -> Point { + return {.x = self.x * v, .y = self.y * v}; } // CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/impl/fail_ambiguous_impl.carbon:[[@LINE+1]]: ambiguous implementations of interface Vector for class Point } diff --git a/explorer/testdata/impl/fail_unambiguous_impl_generic.carbon b/explorer/testdata/impl/fail_unambiguous_impl_generic.carbon index 482048b46e62d..c72f0deba535c 100644 --- a/explorer/testdata/impl/fail_unambiguous_impl_generic.carbon +++ b/explorer/testdata/impl/fail_unambiguous_impl_generic.carbon @@ -11,8 +11,8 @@ package ExplorerTest api; interface Vector(T:! Type) { - fn Add[me: Self](b: Self) -> Self; - fn Scale[me: Self](v: T) -> Self; + fn Add[self: Self](b: Self) -> Self; + fn Scale[self: Self](v: T) -> Self; } class Point(T:! Type) { @@ -21,20 +21,20 @@ class Point(T:! Type) { } external impl Point(i32) as Vector(i32) { - fn Add[me: Self](b: Self) -> Self { - return {.x = me.x + b.x, .y = me.y + b.y}; + fn Add[self: Self](b: Self) -> Self { + return {.x = self.x + b.x, .y = self.y + b.y}; } - fn Scale[me: Self](v: i32) -> Self { - return {.x = me.x * v, .y = me.y * v}; + fn Scale[self: Self](v: i32) -> Self { + return {.x = self.x * v, .y = self.y * v}; } } external impl forall [T:! Type] Point(T) as Vector(T) { - fn Add[me: Self](b: Self) -> Self { - return me; + fn Add[self: Self](b: Self) -> Self { + return self; } - fn Scale[me: Self](v: T) -> Self { - return me; + fn Scale[self: Self](v: T) -> Self { + return self; } } diff --git a/explorer/testdata/impl/generic_method_impl.carbon b/explorer/testdata/impl/generic_method_impl.carbon index 6533f9b677046..1f2697a87f732 100644 --- a/explorer/testdata/impl/generic_method_impl.carbon +++ b/explorer/testdata/impl/generic_method_impl.carbon @@ -14,16 +14,16 @@ package ExplorerTest api; class Cell(T:! Type) { fn Create(x: T) -> Cell(T) { return { .data = x }; } - fn Get[me: Self]() -> T { - return me.data; + fn Get[self: Self]() -> T { + return self.data; } - fn Put[addr me: Self*](x: T) { - (*me).data = x; + fn Put[addr self: Self*](x: T) { + (*self).data = x; } - fn Update[addr me: Self*, U:! ImplicitAs(T)](x: U) { - (*me).data = x; + fn Update[addr self: Self*, U:! ImplicitAs(T)](x: U) { + (*self).data = x; } - fn CreateOther[me: Self, U:! Type](x: U) -> Cell(U) { + fn CreateOther[self: Self, U:! Type](x: U) -> Cell(U) { return {.data = x}; } var data: T; @@ -34,7 +34,7 @@ class Integer { } impl Integer as ImplicitAs(Integer) { - fn Convert[me: Self]() -> Integer { return me; } + fn Convert[self: Self]() -> Integer { return self; } } fn Main() -> i32 { diff --git a/explorer/testdata/impl/impl_in_generic_class.carbon b/explorer/testdata/impl/impl_in_generic_class.carbon index 94e2f2959d32b..3e61634bd9485 100644 --- a/explorer/testdata/impl/impl_in_generic_class.carbon +++ b/explorer/testdata/impl/impl_in_generic_class.carbon @@ -12,12 +12,12 @@ package ExplorerTest api; interface I(T:! Type) { - fn F[me: Self](t: T, o: Self) -> Self; + fn F[self: Self](t: T, o: Self) -> Self; } class X(U:! Type) { impl as I(U) { - fn F[me: Self](u: U, o: Self) -> Self { return {.m = u, .n = me.n + o.n}; } + fn F[self: Self](u: U, o: Self) -> Self { return {.m = u, .n = self.n + o.n}; } } var m: U; var n: i32; diff --git a/explorer/testdata/impl/param_impl.carbon b/explorer/testdata/impl/param_impl.carbon index 4b67ef17c222b..af6885c2a01d9 100644 --- a/explorer/testdata/impl/param_impl.carbon +++ b/explorer/testdata/impl/param_impl.carbon @@ -13,7 +13,7 @@ package ExplorerTest api; interface Number { fn Zero() -> Self; - fn Add[me: Self](other: Self) -> Self; + fn Add[self: Self](other: Self) -> Self; } class Point(T:! Number) { @@ -23,13 +23,13 @@ class Point(T:! Number) { external impl i32 as Number { fn Zero() -> i32 { return 0; } - fn Add[me: i32](other: i32) -> i32 { return me + other; } + fn Add[self: i32](other: i32) -> i32 { return self + other; } } external impl forall [U:! Number] Point(U) as Number { fn Zero() -> Point(U) { return {.x = U.Zero(), .y = U.Zero() }; } - fn Add[me: Point(U)](other: Point(U)) -> Point(U) { - return {.x = me.x.Add(other.x), .y = me.y.Add(other.y)}; + fn Add[self: Point(U)](other: Point(U)) -> Point(U) { + return {.x = self.x.Add(other.x), .y = self.y.Add(other.y)}; } } diff --git a/explorer/testdata/impl/param_impl2.carbon b/explorer/testdata/impl/param_impl2.carbon index 26fd213da650a..9708ad29a62ae 100644 --- a/explorer/testdata/impl/param_impl2.carbon +++ b/explorer/testdata/impl/param_impl2.carbon @@ -13,7 +13,7 @@ package ExplorerTest api; interface Number { fn Zero() -> Self; - fn Add[me: Self](other: Self) -> Self; + fn Add[self: Self](other: Self) -> Self; } class Point(T:! Number) { @@ -23,13 +23,13 @@ class Point(T:! Number) { external impl i32 as Number { fn Zero() -> i32 { return 0; } - fn Add[me: i32](other: i32) -> i32 { return me + other; } + fn Add[self: i32](other: i32) -> i32 { return self + other; } } external impl forall [U:! Number] Point(U) as Number { fn Zero() -> Point(U) { return {.x = U.Zero(), .y = U.Zero() }; } - fn Add[me: Point(U)](other: Point(U)) -> Point(U) { - return {.x = me.x.Add(other.x), .y = me.y.Add(other.y)}; + fn Add[self: Point(U)](other: Point(U)) -> Point(U) { + return {.x = self.x.Add(other.x), .y = self.y.Add(other.y)}; } } diff --git a/explorer/testdata/impl/param_impl_with_self.carbon b/explorer/testdata/impl/param_impl_with_self.carbon index 8a5e8f5e49888..d3975649da0b8 100644 --- a/explorer/testdata/impl/param_impl_with_self.carbon +++ b/explorer/testdata/impl/param_impl_with_self.carbon @@ -13,7 +13,7 @@ package ExplorerTest api; interface Number { fn Zero() -> Self; - fn Add[me: Self](other: Self) -> Self; + fn Add[self: Self](other: Self) -> Self; } class Point(T:! Number) { @@ -23,14 +23,14 @@ class Point(T:! Number) { external impl i32 as Number { fn Zero() -> i32 { return 0; } - fn Add[me: i32](other: i32) -> i32 { return me + other; } + fn Add[self: i32](other: i32) -> i32 { return self + other; } } external impl forall [U:! Number] Point(U) as Number { // Allowed: `Self` means `Point(U)` here. fn Zero() -> Self { return {.x = U.Zero(), .y = U.Zero() }; } - fn Add[me: Self](other: Self) -> Self { - return {.x = me.x.Add(other.x), .y = me.y.Add(other.y)}; + fn Add[self: Self](other: Self) -> Self { + return {.x = self.x.Add(other.x), .y = self.y.Add(other.y)}; } } diff --git a/explorer/testdata/interface/class_function.carbon b/explorer/testdata/interface/class_function.carbon index 9a27bc26c43d9..44d6262d86d92 100644 --- a/explorer/testdata/interface/class_function.carbon +++ b/explorer/testdata/interface/class_function.carbon @@ -13,8 +13,8 @@ package ExplorerTest api; interface Vector { fn Zero() -> Self; - fn Add[me: Self](b: Self) -> Self; - fn Scale[me: Self](v: i32) -> Self; + fn Add[self: Self](b: Self) -> Self; + fn Scale[self: Self](v: i32) -> Self; } class Point { @@ -24,11 +24,11 @@ class Point { fn Zero() -> Point { return {.x = 0, .y = 0}; } - fn Add[me: Point](b: Point) -> Point { - return {.x = me.x + b.x, .y = me.y + b.y}; + fn Add[self: Point](b: Point) -> Point { + return {.x = self.x + b.x, .y = self.y + b.y}; } - fn Scale[me: Point](v: i32) -> Point { - return {.x = me.x * v, .y = me.y * v}; + fn Scale[self: Point](v: i32) -> Point { + return {.x = self.x * v, .y = self.y * v}; } } } diff --git a/explorer/testdata/interface/constrained_parameter.carbon b/explorer/testdata/interface/constrained_parameter.carbon index e6b3a747e5907..5608e2b1ff149 100644 --- a/explorer/testdata/interface/constrained_parameter.carbon +++ b/explorer/testdata/interface/constrained_parameter.carbon @@ -12,16 +12,16 @@ package ExplorerTest api; interface AddMul { - fn Add[me: Self](o: Self) -> Self; - fn Mul[me: Self](o: Self) -> Self; + fn Add[self: Self](o: Self) -> Self; + fn Mul[self: Self](o: Self) -> Self; } external impl i32 as AddMul { - fn Add[me: i32](o: i32) -> i32 { - return me + o; + fn Add[self: i32](o: i32) -> i32 { + return self + o; } - fn Mul[me: i32](o: i32) -> i32 { - return me * o; + fn Mul[self: i32](o: i32) -> i32 { + return self * o; } } @@ -31,9 +31,9 @@ class Holder(T:! AddMul) { interface Vector(Scalar:! AddMul) { fn Zero() -> Self; - fn Add[me: Self](b: Self) -> Self; - fn Scale[me: Self](v: Scalar) -> Self; - fn Hold[me: Self](v: Scalar) -> Holder(Scalar); + fn Add[self: Self](b: Self) -> Self; + fn Scale[self: Self](v: Scalar) -> Self; + fn Hold[self: Self](v: Scalar) -> Holder(Scalar); } class Point { @@ -43,13 +43,13 @@ class Point { fn Zero() -> Point { return {.x = 0, .y = 0}; } - fn Add[me: Point](b: Point) -> Point { - return {.x = me.x + b.x, .y = me.y + b.y}; + fn Add[self: Point](b: Point) -> Point { + return {.x = self.x + b.x, .y = self.y + b.y}; } - fn Scale[me: Point](v: i32) -> Point { - return {.x = me.x * v, .y = me.y * v}; + fn Scale[self: Point](v: i32) -> Point { + return {.x = self.x * v, .y = self.y * v}; } - fn Hold[me: Point](v: i32) -> Holder(i32) { + fn Hold[self: Point](v: i32) -> Holder(i32) { return {.v = v}; } } diff --git a/explorer/testdata/interface/external_impl_point_vector.carbon b/explorer/testdata/interface/external_impl_point_vector.carbon index 143ad3df2dc29..0d2788602d82c 100644 --- a/explorer/testdata/interface/external_impl_point_vector.carbon +++ b/explorer/testdata/interface/external_impl_point_vector.carbon @@ -12,8 +12,8 @@ package ExplorerTest api; interface Vector { - fn Add[me: Self](b: Self) -> Self; - fn Scale[me: Self](v: i32) -> Self; + fn Add[self: Self](b: Self) -> Self; + fn Scale[self: Self](v: i32) -> Self; } class Point { @@ -22,11 +22,11 @@ class Point { } external impl Point as Vector { - fn Add[me: Point](b: Point) -> Point { - return {.x = me.x + b.x, .y = me.y + b.y}; + fn Add[self: Point](b: Point) -> Point { + return {.x = self.x + b.x, .y = self.y + b.y}; } - fn Scale[me: Point](v: i32) -> Point { - return {.x = me.x * v, .y = me.y * v}; + fn Scale[self: Point](v: i32) -> Point { + return {.x = self.x * v, .y = self.y * v}; } } diff --git a/explorer/testdata/interface/external_impl_use_self.carbon b/explorer/testdata/interface/external_impl_use_self.carbon index cff62cf76d9f4..8a0513c2332dc 100644 --- a/explorer/testdata/interface/external_impl_use_self.carbon +++ b/explorer/testdata/interface/external_impl_use_self.carbon @@ -12,8 +12,8 @@ package ExplorerTest api; interface Vector { - fn Add[me: Self](b: Self) -> Self; - fn Scale[me: Self](v: i32) -> Self; + fn Add[self: Self](b: Self) -> Self; + fn Scale[self: Self](v: i32) -> Self; } class Point { @@ -23,11 +23,11 @@ class Point { external impl Point as Vector { // Allowed: `Self` means `Point` here. - fn Add[me: Self](b: Self) -> Self { - return {.x = me.x + b.x, .y = me.y + b.y}; + fn Add[self: Self](b: Self) -> Self { + return {.x = self.x + b.x, .y = self.y + b.y}; } - fn Scale[me: Self](v: i32) -> Self { - return {.x = me.x * v, .y = me.y * v}; + fn Scale[self: Self](v: i32) -> Self { + return {.x = self.x * v, .y = self.y * v}; } } diff --git a/explorer/testdata/interface/fail_external_impl_omit_self.carbon b/explorer/testdata/interface/fail_external_impl_omit_self.carbon index b4fb2e34fa1d6..bdab0dafc0c32 100644 --- a/explorer/testdata/interface/fail_external_impl_omit_self.carbon +++ b/explorer/testdata/interface/fail_external_impl_omit_self.carbon @@ -11,8 +11,8 @@ package ExplorerTest api; interface Vector { - fn Add[me: Self](b: Self) -> Self; - fn Scale[me: Self](v: i32) -> Self; + fn Add[self: Self](b: Self) -> Self; + fn Scale[self: Self](v: i32) -> Self; } class Point { @@ -23,11 +23,11 @@ class Point { // Error: need to specify which type implementing `Vector` for. // CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/interface/fail_external_impl_omit_self.carbon:[[@LINE+1]]: could not resolve 'Self' external impl as Vector { - fn Add[me: Point](b: Point) -> Point { - return {.x = me.x + b.x, .y = me.y + b.y}; + fn Add[self: Point](b: Point) -> Point { + return {.x = self.x + b.x, .y = self.y + b.y}; } - fn Scale[me: Point](v: i32) -> Point { - return {.x = me.x * v, .y = me.y * v}; + fn Scale[self: Point](v: i32) -> Point { + return {.x = self.x * v, .y = self.y * v}; } } diff --git a/explorer/testdata/interface/fail_external_impl_self.carbon b/explorer/testdata/interface/fail_external_impl_self.carbon index 84946129165ca..4ee93a93fb132 100644 --- a/explorer/testdata/interface/fail_external_impl_self.carbon +++ b/explorer/testdata/interface/fail_external_impl_self.carbon @@ -11,8 +11,8 @@ package ExplorerTest api; interface Vector { - fn Add[me: Self](b: Self) -> Self; - fn Scale[me: Self](v: i32) -> Self; + fn Add[self: Self](b: Self) -> Self; + fn Scale[self: Self](v: i32) -> Self; } class Point { @@ -22,11 +22,11 @@ class Point { // CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/interface/fail_external_impl_self.carbon:[[@LINE+1]]: could not resolve 'Self' external impl Self as Vector { - fn Add[me: Point](b: Point) -> Point { - return {.x = me.x + b.x, .y = me.y + b.y}; + fn Add[self: Point](b: Point) -> Point { + return {.x = self.x + b.x, .y = self.y + b.y}; } - fn Scale[me: Point](v: i32) -> Point { - return {.x = me.x * v, .y = me.y * v}; + fn Scale[self: Point](v: i32) -> Point { + return {.x = self.x * v, .y = self.y * v}; } } diff --git a/explorer/testdata/interface/fail_impl_bad_member.carbon b/explorer/testdata/interface/fail_impl_bad_member.carbon index 65d769f7d801b..507c4f11b7081 100644 --- a/explorer/testdata/interface/fail_impl_bad_member.carbon +++ b/explorer/testdata/interface/fail_impl_bad_member.carbon @@ -11,18 +11,18 @@ package ExplorerTest api; interface Vector { - fn Add[me: Self](b: Self) -> Self; - fn Scale[me: Self](v: i32) -> Self; + fn Add[self: Self](b: Self) -> Self; + fn Scale[self: Self](v: i32) -> Self; } class Point { var x: i32; var y: i32; impl Point as Vector { - fn Add[me: Point](b: Point) -> Point { - return {.x = me.x + b.x, .y = me.y + b.y}; + fn Add[self: Point](b: Point) -> Point { + return {.x = self.x + b.x, .y = self.y + b.y}; } - fn Scale[me: Point](v: i32) -> i32 { + fn Scale[self: Point](v: i32) -> i32 { return 0; // CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/interface/fail_impl_bad_member.carbon:[[@LINE+3]]: type error in member of implementation // CHECK: expected: fn (i32) -> class Point diff --git a/explorer/testdata/interface/fail_impl_missing_member.carbon b/explorer/testdata/interface/fail_impl_missing_member.carbon index 4d7b419e828b0..60b8c711f204b 100644 --- a/explorer/testdata/interface/fail_impl_missing_member.carbon +++ b/explorer/testdata/interface/fail_impl_missing_member.carbon @@ -11,16 +11,16 @@ package ExplorerTest api; interface Vector { - fn Add[me: Self](b: Self) -> Self; - fn Scale[me: Self](v: i32) -> Self; + fn Add[self: Self](b: Self) -> Self; + fn Scale[self: Self](v: i32) -> Self; } class Point { var x: i32; var y: i32; impl Point as Vector { - fn Add[me: Point](b: Point) -> Point { - return {.x = me.x + b.x, .y = me.y + b.y}; + fn Add[self: Point](b: Point) -> Point { + return {.x = self.x + b.x, .y = self.y + b.y}; } // CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/interface/fail_impl_missing_member.carbon:[[@LINE+1]]: implementation missing Scale } diff --git a/explorer/testdata/interface/fail_interface_missing_member.carbon b/explorer/testdata/interface/fail_interface_missing_member.carbon index 14bbe7fb0a469..607bcff20b4c9 100644 --- a/explorer/testdata/interface/fail_interface_missing_member.carbon +++ b/explorer/testdata/interface/fail_interface_missing_member.carbon @@ -11,7 +11,7 @@ package ExplorerTest api; interface Vector { - fn Add[me: Self](b: Self) -> Self; + fn Add[self: Self](b: Self) -> Self; } fn ScaleGeneric[T:! Vector](a: T, s: i32) -> T { @@ -23,8 +23,8 @@ class Point { var x: i32; var y: i32; impl Point as Vector { - fn Add[me: Point](b: Point) -> Point { - return {.x = me.x + b.x, .y = me.y + b.y}; + fn Add[self: Point](b: Point) -> Point { + return {.x = self.x + b.x, .y = self.y + b.y}; } } } diff --git a/explorer/testdata/interface/fail_no_impl.carbon b/explorer/testdata/interface/fail_no_impl.carbon index db752f278856a..cf91361890d87 100644 --- a/explorer/testdata/interface/fail_no_impl.carbon +++ b/explorer/testdata/interface/fail_no_impl.carbon @@ -11,8 +11,8 @@ package ExplorerTest api; interface Vector { - fn Add[me: Self](b: Self) -> Self; - fn Scale[me: Self](v: i32) -> Self; + fn Add[self: Self](b: Self) -> Self; + fn Scale[self: Self](v: i32) -> Self; } class Point { diff --git a/explorer/testdata/interface/generic_call_generic.carbon b/explorer/testdata/interface/generic_call_generic.carbon index 9a016f1dbe0f8..c30dafac8a953 100644 --- a/explorer/testdata/interface/generic_call_generic.carbon +++ b/explorer/testdata/interface/generic_call_generic.carbon @@ -12,19 +12,19 @@ package ExplorerTest api; interface Vector { - fn Add[me: Self](b: Self) -> Self; - fn Scale[me: Self](v: i32) -> Self; + fn Add[self: Self](b: Self) -> Self; + fn Scale[self: Self](v: i32) -> Self; } class Point { var x: i32; var y: i32; impl Point as Vector { - fn Add[me: Point](b: Point) -> Point { - return {.x = me.x + b.x, .y = me.y + b.y}; + fn Add[self: Point](b: Point) -> Point { + return {.x = self.x + b.x, .y = self.y + b.y}; } - fn Scale[me: Point](v: i32) -> Point { - return {.x = me.x * v, .y = me.y * v}; + fn Scale[self: Point](v: i32) -> Point { + return {.x = self.x * v, .y = self.y * v}; } } } diff --git a/explorer/testdata/interface/generic_with_two_params.carbon b/explorer/testdata/interface/generic_with_two_params.carbon index ac50395ee781f..8b49e7ae646a6 100644 --- a/explorer/testdata/interface/generic_with_two_params.carbon +++ b/explorer/testdata/interface/generic_with_two_params.carbon @@ -12,19 +12,19 @@ package ExplorerTest api; interface Vector { - fn Add[me: Self](b: Self) -> Self; - fn Scale[me: Self](v: i32) -> Self; + fn Add[self: Self](b: Self) -> Self; + fn Scale[self: Self](v: i32) -> Self; } class Point1 { var x: i32; var y: i32; impl Point1 as Vector { - fn Add[me: Point1](b: Point1) -> Point1 { - return {.x = me.x + b.x, .y = me.y + b.y}; + fn Add[self: Point1](b: Point1) -> Point1 { + return {.x = self.x + b.x, .y = self.y + b.y}; } - fn Scale[me: Point1](v: i32) -> Point1 { - return {.x = me.x * v, .y = me.y * v}; + fn Scale[self: Point1](v: i32) -> Point1 { + return {.x = self.x * v, .y = self.y * v}; } } } @@ -33,11 +33,11 @@ class Point2 { var x: i32; var y: i32; impl Point2 as Vector { - fn Add[me: Point2](b: Point2) -> Point2 { - return {.x = me.x + b.x + 1, .y = me.y + b.y + 1}; + fn Add[self: Point2](b: Point2) -> Point2 { + return {.x = self.x + b.x + 1, .y = self.y + b.y + 1}; } - fn Scale[me: Point2](v: i32) -> Point2 { - return {.x = me.x * v * 2, .y = me.y * v * 2}; + fn Scale[self: Point2](v: i32) -> Point2 { + return {.x = self.x * v * 2, .y = self.y * v * 2}; } } } diff --git a/explorer/testdata/interface/impl_self_interface_parameter.carbon b/explorer/testdata/interface/impl_self_interface_parameter.carbon index 985dfbfc0977b..998d674af058e 100644 --- a/explorer/testdata/interface/impl_self_interface_parameter.carbon +++ b/explorer/testdata/interface/impl_self_interface_parameter.carbon @@ -12,7 +12,7 @@ package ExplorerTest api; interface AddWith(T:! Type) { - fn Op[me: Self](b: T) -> Self; + fn Op[self: Self](b: T) -> Self; } class Point { @@ -22,8 +22,8 @@ class Point { // Allowed: `Self` means `Point` after `as` impl Point as AddWith(Self) { - fn Op[me: Point](b: Point) -> Point { - return {.x = me.x + b.x, .y = me.y + b.y}; + fn Op[self: Point](b: Point) -> Point { + return {.x = self.x + b.x, .y = self.y + b.y}; } } diff --git a/explorer/testdata/interface/omit_self.carbon b/explorer/testdata/interface/omit_self.carbon index 32db2d5ae0f49..b311da009f057 100644 --- a/explorer/testdata/interface/omit_self.carbon +++ b/explorer/testdata/interface/omit_self.carbon @@ -13,8 +13,8 @@ package ExplorerTest api; interface Vector { fn Zero() -> Self; - fn Add[me: Self](b: Self) -> Self; - fn Scale[me: Self](v: i32) -> Self; + fn Add[self: Self](b: Self) -> Self; + fn Scale[self: Self](v: i32) -> Self; } class Point { @@ -26,11 +26,11 @@ class Point { fn Zero() -> Point { return {.x = 0, .y = 0}; } - fn Add[me: Point](b: Point) -> Point { - return {.x = me.x + b.x, .y = me.y + b.y}; + fn Add[self: Point](b: Point) -> Point { + return {.x = self.x + b.x, .y = self.y + b.y}; } - fn Scale[me: Point](v: i32) -> Point { - return {.x = me.x * v, .y = me.y * v}; + fn Scale[self: Point](v: i32) -> Point { + return {.x = self.x * v, .y = self.y * v}; } } } diff --git a/explorer/testdata/interface/param_with_dependent_type.carbon b/explorer/testdata/interface/param_with_dependent_type.carbon index e8ffa9e656277..8d2db664b81d7 100644 --- a/explorer/testdata/interface/param_with_dependent_type.carbon +++ b/explorer/testdata/interface/param_with_dependent_type.carbon @@ -12,11 +12,11 @@ package ExplorerTest api; interface HasValueParam(T:! Type, V:! T) { - fn Go[me: Self]() -> T; + fn Go[self: Self]() -> T; } impl () as HasValueParam(i32, 5) { - fn Go[me: Self]() -> i32 { return 42; } + fn Go[self: Self]() -> i32 { return 42; } } fn Main() -> i32 { diff --git a/explorer/testdata/interface/parameterized.carbon b/explorer/testdata/interface/parameterized.carbon index c66d1cc716527..fdd69383c4ddf 100644 --- a/explorer/testdata/interface/parameterized.carbon +++ b/explorer/testdata/interface/parameterized.carbon @@ -13,8 +13,8 @@ package ExplorerTest api; interface Vector(Scalar:! Type) { fn Zero() -> Self; - fn Add[me: Self](b: Self) -> Self; - fn Scale[me: Self](v: Scalar) -> Self; + fn Add[self: Self](b: Self) -> Self; + fn Scale[self: Self](v: Scalar) -> Self; } class Point { @@ -24,11 +24,11 @@ class Point { fn Zero() -> Point { return {.x = 0, .y = 0}; } - fn Add[me: Point](b: Point) -> Point { - return {.x = me.x + b.x, .y = me.y + b.y}; + fn Add[self: Point](b: Point) -> Point { + return {.x = self.x + b.x, .y = self.y + b.y}; } - fn Scale[me: Point](v: i32) -> Point { - return {.x = me.x * v, .y = me.y * v}; + fn Scale[self: Point](v: i32) -> Point { + return {.x = self.x * v, .y = self.y * v}; } } } diff --git a/explorer/testdata/interface/tuple_vector_add_scale.carbon b/explorer/testdata/interface/tuple_vector_add_scale.carbon index 35f6294685f6e..ff40238df343f 100644 --- a/explorer/testdata/interface/tuple_vector_add_scale.carbon +++ b/explorer/testdata/interface/tuple_vector_add_scale.carbon @@ -12,19 +12,19 @@ package ExplorerTest api; interface Vector { - fn Add[me: Self](b: Self) -> Self; - fn Scale[me: Self](v: i32) -> Self; + fn Add[self: Self](b: Self) -> Self; + fn Scale[self: Self](v: i32) -> Self; } class Point { var x: i32; var y: i32; impl Point as Vector { - fn Add[me: Point](b: Point) -> Point { - return {.x = me.x + b.x, .y = me.y + b.y}; + fn Add[self: Point](b: Point) -> Point { + return {.x = self.x + b.x, .y = self.y + b.y}; } - fn Scale[me: Point](v: i32) -> Point { - return {.x = me.x * v, .y = me.y * v}; + fn Scale[self: Point](v: i32) -> Point { + return {.x = self.x * v, .y = self.y * v}; } } } diff --git a/explorer/testdata/interface/vector_point_add_scale.carbon b/explorer/testdata/interface/vector_point_add_scale.carbon index 961b19c713604..4db8e25457df5 100644 --- a/explorer/testdata/interface/vector_point_add_scale.carbon +++ b/explorer/testdata/interface/vector_point_add_scale.carbon @@ -12,19 +12,19 @@ package ExplorerTest api; interface Vector { - fn Add[me: Self](b: Self) -> Self; - fn Scale[me: Self](v: i32) -> Self; + fn Add[self: Self](b: Self) -> Self; + fn Scale[self: Self](v: i32) -> Self; } class Point { var x: i32; var y: i32; impl Point as Vector { - fn Add[me: Point](b: Point) -> Point { - return {.x = me.x + b.x, .y = me.y + b.y}; + fn Add[self: Point](b: Point) -> Point { + return {.x = self.x + b.x, .y = self.y + b.y}; } - fn Scale[me: Point](v: i32) -> Point { - return {.x = me.x * v, .y = me.y * v}; + fn Scale[self: Point](v: i32) -> Point { + return {.x = self.x * v, .y = self.y * v}; } } } diff --git a/explorer/testdata/interface/with_self.carbon b/explorer/testdata/interface/with_self.carbon index 95c49ea532f86..b94ad83fa67ae 100644 --- a/explorer/testdata/interface/with_self.carbon +++ b/explorer/testdata/interface/with_self.carbon @@ -13,8 +13,8 @@ package ExplorerTest api; interface Vector { fn Zero() -> Self; - fn Add[me: Self](b: Self) -> Self; - fn Scale[me: Self](v: i32) -> Self; + fn Add[self: Self](b: Self) -> Self; + fn Scale[self: Self](v: i32) -> Self; } class Point { @@ -25,11 +25,11 @@ class Point { fn Zero() -> Self { return {.x = 0, .y = 0}; } - fn Add[me: Self](b: Self) -> Self { - return {.x = me.x + b.x, .y = me.y + b.y}; + fn Add[self: Self](b: Self) -> Self { + return {.x = self.x + b.x, .y = self.y + b.y}; } - fn Scale[me: Self](v: i32) -> Self { - return {.x = me.x * v, .y = me.y * v}; + fn Scale[self: Self](v: i32) -> Self { + return {.x = self.x * v, .y = self.y * v}; } } } diff --git a/explorer/testdata/let/fail_method_args.carbon b/explorer/testdata/let/fail_method_args.carbon index f0c36a058a572..2c2f679891565 100644 --- a/explorer/testdata/let/fail_method_args.carbon +++ b/explorer/testdata/let/fail_method_args.carbon @@ -15,7 +15,7 @@ class Point { return {.x = 0, .y = 0}; } - fn SetX[me: Point](x: i32) { + fn SetX[self: Point](x: i32) { // CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/let/fail_method_args.carbon:[[@LINE+1]]: Cannot assign to rvalue 'x' x = 10; } diff --git a/explorer/testdata/let/implicit_conversion.carbon b/explorer/testdata/let/implicit_conversion.carbon index c6974d493109b..f6bb168bbf4c3 100644 --- a/explorer/testdata/let/implicit_conversion.carbon +++ b/explorer/testdata/let/implicit_conversion.carbon @@ -13,7 +13,7 @@ package ExplorerTest api; class A { impl as ImplicitAs(i32) { - fn Convert[me: Self]() -> i32 { return me.n; } + fn Convert[self: Self]() -> i32 { return self.n; } } var n: i32; } diff --git a/explorer/testdata/let/implicit_conversion_choice.carbon b/explorer/testdata/let/implicit_conversion_choice.carbon index 3cc2864a8fe5f..ca7370618cfc3 100644 --- a/explorer/testdata/let/implicit_conversion_choice.carbon +++ b/explorer/testdata/let/implicit_conversion_choice.carbon @@ -16,7 +16,7 @@ choice A { } impl i32 as ImplicitAs(A) { - fn Convert[me: Self]() -> A { return A.Value(me + 1); } + fn Convert[self: Self]() -> A { return A.Value(self + 1); } } fn Main() -> i32 { diff --git a/explorer/testdata/match/convert.carbon b/explorer/testdata/match/convert.carbon index 631aad4cf6695..28acd1d73fa00 100644 --- a/explorer/testdata/match/convert.carbon +++ b/explorer/testdata/match/convert.carbon @@ -13,7 +13,7 @@ package ExplorerTest api; class A {} impl A as ImplicitAs(i32) { - fn Convert[me: Self]() -> i32 { return 1; } + fn Convert[self: Self]() -> i32 { return 1; } } fn Main() -> i32 { diff --git a/explorer/testdata/match/fail_pattern_type_mismatch.carbon b/explorer/testdata/match/fail_pattern_type_mismatch.carbon index 49b620e1e7eb2..ec0b34f7a38a9 100644 --- a/explorer/testdata/match/fail_pattern_type_mismatch.carbon +++ b/explorer/testdata/match/fail_pattern_type_mismatch.carbon @@ -12,7 +12,7 @@ package ExplorerTest api; class A {} impl A as ImplicitAs(i32) { - fn Convert[me: Self]() -> i32 { return 1; } + fn Convert[self: Self]() -> i32 { return 1; } } fn Main() -> i32 { diff --git a/explorer/testdata/member_access/convert_lhs_class.carbon b/explorer/testdata/member_access/convert_lhs_class.carbon index 29c74a36e464e..9fc998b7bfef3 100644 --- a/explorer/testdata/member_access/convert_lhs_class.carbon +++ b/explorer/testdata/member_access/convert_lhs_class.carbon @@ -12,14 +12,14 @@ package Foo api; class X { - fn F[me: Self](o: Self) -> Self { return {.n = me.n + o.n}; } + fn F[self: Self](o: Self) -> Self { return {.n = self.n + o.n}; } var n: i32; } class Y { var m: i32; impl as ImplicitAs(X) { - fn Convert[me: Self]() -> X { return {.n = me.m}; } + fn Convert[self: Self]() -> X { return {.n = self.m}; } } } diff --git a/explorer/testdata/member_access/convert_lhs_interface.carbon b/explorer/testdata/member_access/convert_lhs_interface.carbon index 811d3d5cf84f9..d7216a9a8749a 100644 --- a/explorer/testdata/member_access/convert_lhs_interface.carbon +++ b/explorer/testdata/member_access/convert_lhs_interface.carbon @@ -12,12 +12,12 @@ package Foo api; interface HasF { - fn F[me: Self](o: Self) -> Self; + fn F[self: Self](o: Self) -> Self; } class X { impl as HasF { - fn F[me: Self](o: Self) -> Self { return {.n = me.n + o.n}; } + fn F[self: Self](o: Self) -> Self { return {.n = self.n + o.n}; } } var n: i32; } @@ -25,7 +25,7 @@ class X { class Y { var m: i32; impl as ImplicitAs(X) { - fn Convert[me: Self]() -> X { return {.n = me.m}; } + fn Convert[self: Self]() -> X { return {.n = self.m}; } } } diff --git a/explorer/testdata/member_access/evaluate_type_before_dot.carbon b/explorer/testdata/member_access/evaluate_type_before_dot.carbon index 09277dd284256..a682da3c4f62b 100644 --- a/explorer/testdata/member_access/evaluate_type_before_dot.carbon +++ b/explorer/testdata/member_access/evaluate_type_before_dot.carbon @@ -18,10 +18,10 @@ package Foo api; choice Choice { Alternative() } class Class { fn F(n: i32) -> i32 { return n + 1; } } -interface Interface { fn G[me: Self]() -> Self; } +interface Interface { fn G[self: Self]() -> Self; } interface AnotherInterface {} -impl i32 as Interface { fn G[me: i32]() -> i32 { return me + 1; } } +impl i32 as Interface { fn G[self: i32]() -> i32 { return self + 1; } } impl i32 as AnotherInterface {} // TODO: These are intended to be called at compile time. Mark them as diff --git a/explorer/testdata/member_access/fail_qualified_non_member.carbon b/explorer/testdata/member_access/fail_qualified_non_member.carbon index 6252ce58ebe38..d9e2df4fb2633 100644 --- a/explorer/testdata/member_access/fail_qualified_non_member.carbon +++ b/explorer/testdata/member_access/fail_qualified_non_member.carbon @@ -9,7 +9,7 @@ // AUTOUPDATE: %{explorer} %s package Foo api; -fn F[me: i32]() {} +fn F[self: i32]() {} fn Main() -> i32 { // TODO: It's unclear whether this is valid per the current rules. See // https://github.com/carbon-language/carbon-lang/pull/1122 diff --git a/explorer/testdata/member_access/nearly_vacuous_access_with_instance_binding.carbon b/explorer/testdata/member_access/nearly_vacuous_access_with_instance_binding.carbon index 9cc8cffd78710..c879f02a77ffe 100644 --- a/explorer/testdata/member_access/nearly_vacuous_access_with_instance_binding.carbon +++ b/explorer/testdata/member_access/nearly_vacuous_access_with_instance_binding.carbon @@ -10,10 +10,10 @@ // CHECK: result: 1 package Foo api; -interface A { fn F[me: Self]() -> i32; } +interface A { fn F[self: Self]() -> i32; } class X { impl as A { - fn F[me: Self]() -> i32 { return 1; } + fn F[self: Self]() -> i32 { return 1; } } } fn Main() -> i32 { diff --git a/explorer/testdata/member_access/param_qualified_interface_member.carbon b/explorer/testdata/member_access/param_qualified_interface_member.carbon index bfb8f63f810d0..11b08adca2135 100644 --- a/explorer/testdata/member_access/param_qualified_interface_member.carbon +++ b/explorer/testdata/member_access/param_qualified_interface_member.carbon @@ -11,11 +11,11 @@ package Foo api; interface A { - fn F[me: Self](o: Self) -> Self; + fn F[self: Self](o: Self) -> Self; } class X { impl as A { - fn F[me: Self](o: Self) -> Self { return {.n = me.n + o.n}; } + fn F[self: Self](o: Self) -> Self { return {.n = self.n + o.n}; } } var n: i32; } diff --git a/explorer/testdata/member_access/qualified_class_member.carbon b/explorer/testdata/member_access/qualified_class_member.carbon index c2e16ab4f13ef..bac4da74756cd 100644 --- a/explorer/testdata/member_access/qualified_class_member.carbon +++ b/explorer/testdata/member_access/qualified_class_member.carbon @@ -11,7 +11,7 @@ package Foo api; class X { - fn F[me: Self](o: Self) -> Self { return {.n = me.n + o.n}; } + fn F[self: Self](o: Self) -> Self { return {.n = self.n + o.n}; } var n: i32; } fn Main() -> i32 { diff --git a/explorer/testdata/member_access/qualified_constraint_member.carbon b/explorer/testdata/member_access/qualified_constraint_member.carbon index ed62b95a73987..2dc393cffe3ba 100644 --- a/explorer/testdata/member_access/qualified_constraint_member.carbon +++ b/explorer/testdata/member_access/qualified_constraint_member.carbon @@ -11,7 +11,7 @@ package Foo api; interface A { - fn F[me: Self]() -> i32; + fn F[self: Self]() -> i32; } interface B { fn G(o: Self) -> i32; @@ -19,7 +19,7 @@ interface B { alias C = A & B; class X { impl as A { - fn F[me: Self]() -> i32 { return 10 * me.n; } + fn F[self: Self]() -> i32 { return 10 * self.n; } } impl as B { fn G(o: Self) -> i32 { return o.n; } diff --git a/explorer/testdata/member_access/qualified_interface_member.carbon b/explorer/testdata/member_access/qualified_interface_member.carbon index 77fca174a6f39..4184271f0a719 100644 --- a/explorer/testdata/member_access/qualified_interface_member.carbon +++ b/explorer/testdata/member_access/qualified_interface_member.carbon @@ -11,11 +11,11 @@ package Foo api; interface A { - fn F[me: Self](o: Self) -> Self; + fn F[self: Self](o: Self) -> Self; } class X { impl as A { - fn F[me: Self](o: Self) -> Self { return {.n = me.n + o.n}; } + fn F[self: Self](o: Self) -> Self { return {.n = self.n + o.n}; } } var n: i32; } diff --git a/explorer/testdata/member_access/qualified_param_member.carbon b/explorer/testdata/member_access/qualified_param_member.carbon index e3d16d6f94b7c..a1fe2727269b8 100644 --- a/explorer/testdata/member_access/qualified_param_member.carbon +++ b/explorer/testdata/member_access/qualified_param_member.carbon @@ -11,11 +11,11 @@ package Foo api; interface A { - fn F[me: Self](o: Self) -> Self; + fn F[self: Self](o: Self) -> Self; } class X { impl as A { - fn F[me: Self](o: Self) -> Self { return {.n = me.n + o.n}; } + fn F[self: Self](o: Self) -> Self { return {.n = self.n + o.n}; } } var n: i32; } diff --git a/explorer/testdata/name_lookup/class_fn_body_reorder.carbon b/explorer/testdata/name_lookup/class_fn_body_reorder.carbon index 2c7b60869978b..33957510e042e 100644 --- a/explorer/testdata/name_lookup/class_fn_body_reorder.carbon +++ b/explorer/testdata/name_lookup/class_fn_body_reorder.carbon @@ -14,11 +14,11 @@ package ExplorerTest api; // The bodies of member functions are processed after all immediately enclosing // classes, impls, and interfaces. class A { - fn F[me: Self]() -> i32 { - return G() + me.H(); + fn F[self: Self]() -> i32 { + return G() + self.H(); } fn G() -> i32 { return 1; } - fn H[me: Self]() -> i32 { return 2; } + fn H[self: Self]() -> i32 { return 2; } } fn Main() -> i32 { diff --git a/explorer/testdata/return/convert_return_value.carbon b/explorer/testdata/return/convert_return_value.carbon index d18fc47720bc4..fa50a36211d19 100644 --- a/explorer/testdata/return/convert_return_value.carbon +++ b/explorer/testdata/return/convert_return_value.carbon @@ -13,7 +13,7 @@ package ExplorerTest api; class A { impl as ImplicitAs(i32) { - fn Convert[me: Self]() -> i32 { return 42; } + fn Convert[self: Self]() -> i32 { return 42; } } } diff --git a/explorer/testdata/while/convert_condition.carbon b/explorer/testdata/while/convert_condition.carbon index bf3b3a07bab44..6d15433954d14 100644 --- a/explorer/testdata/while/convert_condition.carbon +++ b/explorer/testdata/while/convert_condition.carbon @@ -15,8 +15,8 @@ class LazyNe { var v1: i32; var v2: i32; impl as ImplicitAs(Bool) { - fn Convert[me: Self]() -> Bool { - return not (me.v1 == me.v2); + fn Convert[self: Self]() -> Bool { + return not (self.v1 == self.v2); } } fn Make(v1: i32, v2: i32) -> Self { diff --git a/highlighting/highlightjs_carbon_lang.js b/highlighting/highlightjs_carbon_lang.js index a17ab6d6450b9..8c7d54965616a 100644 --- a/highlighting/highlightjs_carbon_lang.js +++ b/highlighting/highlightjs_carbon_lang.js @@ -56,7 +56,7 @@ export default function (hljs) { 'library', 'like', 'match', - 'me', + 'self', 'namespace', 'not', 'observe', @@ -269,8 +269,8 @@ export default function (hljs) { returnEnd: true, contains: [...EXPRESSION], }; - const ME_PATTERN = { - scope: 'carbon-me-pattern', + const SELF_PATTERN = { + scope: 'carbon-self-pattern', begin: [/(\b(addr|var)\b)?/, /\s*/, /\bme/, /:/, /\s*/], beginScope: { 1: 'keyword', @@ -281,7 +281,11 @@ export default function (hljs) { returnEnd: true, contains: [...EXPRESSION], }; - const UNPARENTHESIZED_PATTERNS = [ME_PATTERN, BINDING_PATTERN, VALUE_PATTERN]; + const UNPARENTHESIZED_PATTERNS = [ + SELF_PATTERN, + BINDING_PATTERN, + VALUE_PATTERN, + ]; const PARENTHESIZED_PATTERN = { scope: 'carbon-parenthesized-pattern', begin: /\(/, diff --git a/highlighting/highlightjs_example.html b/highlighting/highlightjs_example.html index 0a431e437567c..3df0e87f40e15 100644 --- a/highlighting/highlightjs_example.html +++ b/highlighting/highlightjs_example.html @@ -50,14 +50,14 @@ } abstract class Abstract { - abstract fn DoSomething[me: Self](); + abstract fn DoSomething[self: Self](); } base class Widget { - virtual fn Print[addr me: Self*](var i: i64, x: f32 = 4.2, _: bool); + virtual fn Print[addr self: Self*](var i: i64, x: f32 = 4.2, _: bool); } -fn Widget.Print[addr me: Self*](var i: i64, x: f32, _: bool, 47) { +fn Widget.Print[addr self: Self*](var i: i64, x: f32, _: bool, 47) { Carbon.Print("test" + "t\u{FFFF}his"); Carbon.Print( """ @@ -72,14 +72,14 @@ } class FancyWidget(T:! Type) extends Widget { - impl fn Print[me: Self](); + impl fn Print[self: Self](); impl as Add(T) { - fn Op[me: Self](); + fn Op[self: Self](); } } -fn FancyWidget(T:! Type).Print[me: Self]() { +fn FancyWidget(T:! Type).Print[self: Self]() { Carbon.Print("more test"); } diff --git a/third_party/examples/re2/re2.carbon b/third_party/examples/re2/re2.carbon index 244654301457a..c7cefe23859d5 100644 --- a/third_party/examples/re2/re2.carbon +++ b/third_party/examples/re2/re2.carbon @@ -290,52 +290,52 @@ class RE2 { // TODO: Should a Carbonic RE2 support these? impl StringView as ImplicitAs(RE2) { - fn Convert[me: Self]() -> RE2 { return Make(me); } + fn Convert[self: Self]() -> RE2 { return Make(self); } } impl String as ImplicitAs(RE2) { - fn Convert[me: Self]() -> RE2 { return Make(me); } + fn Convert[self: Self]() -> RE2 { return Make(self); } } impl StringPiece as ImplicitAs(RE2) { - fn Convert[me: Self]() -> RE2 { return Make(me); } + fn Convert[self: Self]() -> RE2 { return Make(self); } } impl as Destroyable; // Returns whether RE2 was created properly. - fn ok[me: Self]() -> Bool { return me.error_code() == ErrorCode.NoError; } + fn ok[self: Self]() -> Bool { return self.error_code() == ErrorCode.NoError; } // The string specification for this RE2. E.g. // RE2 re("ab*c?d+"); // re.pattern(); // "ab*c?d+" - fn pattern[me: Self]() -> String { return me.pattern_; } + fn pattern[self: Self]() -> String { return self.pattern_; } // If RE2 could not be created properly, returns an error string. // Else returns the empty string. - fn error[me: Self]() -> String { return *me.error_; } + fn error[self: Self]() -> String { return *self.error_; } // If RE2 could not be created properly, returns an error code. // Else returns RE2::NoError (== 0). - fn error_code[me: Self]() -> ErrorCode { return me.error_code_; } + fn error_code[self: Self]() -> ErrorCode { return self.error_code_; } // If RE2 could not be created properly, returns the offending // portion of the regexp. - fn error_arg[me: Self]() -> String { return me.error_arg_; } + fn error_arg[self: Self]() -> String { return self.error_arg_; } // Returns the program size, a very approximate measure of a regexp's "cost". // Larger numbers are more expensive than smaller numbers. - fn ProgramSize[me: Self]() -> i32; - fn ReverseProgramSize[me: Self]() -> i32; + fn ProgramSize[self: Self]() -> i32; + fn ReverseProgramSize[self: Self]() -> i32; // If histogram is not null, outputs the program fanout // as a histogram bucketed by powers of 2. // Returns the number of the largest non-empty bucket. - fn ProgramFanout[me: Self](histogram: Cpp.std.vector(i32)*) -> i32; - fn ReverseProgramFanout[me: Self](histogram: Cpp.std.vector(i32)*) -> i32; + fn ProgramFanout[self: Self](histogram: Cpp.std.vector(i32)*) -> i32; + fn ReverseProgramFanout[self: Self](histogram: Cpp.std.vector(i32)*) -> i32; // Returns the underlying Regexp; not for general use. // Returns entire_regexp_ so that callers don't need // to know about prefix_ and prefix_foldcase_. - fn Regexp[me: Self]() -> package.Regexp* { return me.entire_regexp_; } + fn Regexp[self: Self]() -> package.Regexp* { return self.entire_regexp_; } /***** The array-based matching interface ******/ @@ -535,7 +535,7 @@ class RE2 { // do not compile down to infinite repetitions. // // Returns true on success, false on error. - fn PossibleMatchRange[me: Self](min: String*, max: String*, maxlen: i32); + fn PossibleMatchRange[self: Self](min: String*, max: String*, maxlen: i32); // Generic matching interface @@ -552,18 +552,18 @@ class RE2 { // Return the number of capturing subpatterns, or -1 if the // regexp wasn't valid on construction. The overall match ($0) // does not count: if the regexp is "(a)(b)", returns 2. - fn NumberOfCapturingGroups[me: Self]() -> i32 { return me.num_captures_; } + fn NumberOfCapturingGroups[self: Self]() -> i32 { return self.num_captures_; } // Return a map from names to capturing indices. // The map records the index of the leftmost group // with the given name. // NOTE: Originally returned by reference with comment "valid until re is deleted". - fn NamedCapturingGroups[me: Self]() -> Map(String, i32); + fn NamedCapturingGroups[self: Self]() -> Map(String, i32); // Return a map from capturing indices to names. // The map has no entries for unnamed groups. // NOTE: Originally returned by reference with comment "valid until re is deleted". - fn CapturingGroupNames[me: Self]() -> Map(i32, String); + fn CapturingGroupNames[self: Self]() -> Map(i32, String); // General matching routine. // Match against text starting at offset startpos @@ -586,7 +586,7 @@ class RE2 { // empty string, but note that on return, it will not be possible to tell // whether submatch i matched the empty string or did not match: // either way, submatch[i].data() == NULL. - fn Match[me: Self](text: StringPiece, + fn Match[self: Self](text: StringPiece, startpos: i64, endpos: i64, re_anchor: Anchor, @@ -602,7 +602,7 @@ class RE2 { // '\' followed by anything other than a digit or '\'. // A true return value guarantees that Replace() and Extract() won't // fail because of a bad rewrite string. - fn CheckRewriteString[me: Self](rewrite: StringPiece, error: String*) -> bool; + fn CheckRewriteString[self: Self](rewrite: StringPiece, error: String*) -> bool; // Returns the maximum submatch needed for the rewrite to be done by // Replace(). E.g. if rewrite == "foo \\2,\\1", returns 2. @@ -613,7 +613,7 @@ class RE2 { // Returns true on success. This method can fail because of a malformed // rewrite string. CheckRewriteString guarantees that the rewrite will // be successful. - fn Rewrite[me: Self](out: String*, rewrite: StringPiece, + fn Rewrite[self: Self](out: String*, rewrite: StringPiece, vec: ArrayIterator(StringPiece), veclen: i32) -> bool; @@ -696,50 +696,50 @@ class RE2 { impl CannedOptions as ImplicitAs(Self); - fn encoding[me: Self]() -> Encoding { return me.encoding_; } - fn set_encoding[addr me: Self*](encoding: Encoding) { me->encoding_ = encoding; } + fn encoding[self: Self]() -> Encoding { return self.encoding_; } + fn set_encoding[addr self: Self*](encoding: Encoding) { self->encoding_ = encoding; } - fn posix_syntax[me: Self]() -> bool { return me.posix_syntax_; } - fn set_posix_syntax[addr me: Self*](b: bool) { me->posix_syntax_ = b; } + fn posix_syntax[self: Self]() -> bool { return self.posix_syntax_; } + fn set_posix_syntax[addr self: Self*](b: bool) { self->posix_syntax_ = b; } - fn longest_match[me: Self]() -> bool { return me.longest_match_; } - fn set_longest_match[addr me: Self*](b: bool) { me->longest_match_ = b; } + fn longest_match[self: Self]() -> bool { return self.longest_match_; } + fn set_longest_match[addr self: Self*](b: bool) { self->longest_match_ = b; } - fn log_errors[me: Self]() -> bool { return me.log_errors_; } - fn set_log_errors[addr me: Self*](b: bool) { me->log_errors_ = b; } + fn log_errors[self: Self]() -> bool { return self.log_errors_; } + fn set_log_errors[addr self: Self*](b: bool) { self->log_errors_ = b; } - fn max_mem[me: Self]() -> i64 { return me.max_mem_; } - fn set_max_mem[addr me: Self*](m: i64) { me->max_mem_ = m; } + fn max_mem[self: Self]() -> i64 { return self.max_mem_; } + fn set_max_mem[addr self: Self*](m: i64) { self->max_mem_ = m; } - fn literal[me: Self]() -> bool { return me.literal_; } - fn set_literal[addr me: Self*](b: bool) { me->literal_ = b; } + fn literal[self: Self]() -> bool { return self.literal_; } + fn set_literal[addr self: Self*](b: bool) { self->literal_ = b; } - fn never_nl[me: Self]() -> bool { return me.never_nl_; } - fn set_never_nl[addr me: Self*](b: bool) { me->never_nl_ = b; } + fn never_nl[self: Self]() -> bool { return self.never_nl_; } + fn set_never_nl[addr self: Self*](b: bool) { self->never_nl_ = b; } - fn dot_nl[me: Self]() -> bool { return me.dot_nl_; } - fn set_dot_nl[addr me: Self*](b: bool) { me->dot_nl_ = b; } + fn dot_nl[self: Self]() -> bool { return self.dot_nl_; } + fn set_dot_nl[addr self: Self*](b: bool) { self->dot_nl_ = b; } - fn never_capture[me: Self]() -> bool { return me.never_capture_; } - fn set_never_capture[addr me: Self*](b: bool) { me->never_capture_ = b; } + fn never_capture[self: Self]() -> bool { return self.never_capture_; } + fn set_never_capture[addr self: Self*](b: bool) { self->never_capture_ = b; } - fn case_sensitive[me: Self]() -> bool { return me.case_sensitive_; } - fn set_case_sensitive[addr me: Self*](b: bool) { me->case_sensitive_ = b; } + fn case_sensitive[self: Self]() -> bool { return self.case_sensitive_; } + fn set_case_sensitive[addr self: Self*](b: bool) { self->case_sensitive_ = b; } - fn perl_classes[me: Self]() -> bool { return me.perl_classes_; } - fn set_perl_classes[addr me: Self*](b: bool) { me->perl_classes_ = b; } + fn perl_classes[self: Self]() -> bool { return self.perl_classes_; } + fn set_perl_classes[addr self: Self*](b: bool) { self->perl_classes_ = b; } - fn word_boundary[me: Self]() -> bool { return me.word_boundary_; } - fn set_word_boundary[addr me: Self*](b: bool) { me->word_boundary_ = b; } + fn word_boundary[self: Self]() -> bool { return self.word_boundary_; } + fn set_word_boundary[addr self: Self*](b: bool) { self->word_boundary_ = b; } - fn one_line[me: Self]() -> bool { return me.one_line_; } - fn set_one_line[addr me: Self*](b: bool) { me->one_line_ = b; } + fn one_line[self: Self]() -> bool { return self.one_line_; } + fn set_one_line[addr self: Self*](b: bool) { self->one_line_ = b; } - fn Copy[addr me: Self*](src: Options) { - *me = src; + fn Copy[addr self: Self*](src: Options) { + *self = src; } - fn ParseFlags[me: Self]() -> i32; + fn ParseFlags[self: Self]() -> i32; private var encoding_: Encoding; private var posix_syntax_: bool; @@ -757,7 +757,7 @@ class RE2 { }; // Returns the options set in the constructor. - fn options[me: Self]() -> Options { return me.options_; } + fn options[self: Self]() -> Options { return self.options_; } // Argument converters; see below. // TODO: Should these be package members not class members in Carbon @@ -766,9 +766,9 @@ class RE2 { fn Hex[T:! Parse4ary](ptr: T*) -> Self.Arg; fn Octal[T:! Parse4ary](ptr: T*) -> Self.Arg; - private fn Init[addr me: Self](pattern: StringPiece, options: Options); + private fn Init[addr self: Self](pattern: StringPiece, options: Options); - private fn DoMatch[me: Self](text: StringPiece, + private fn DoMatch[self: Self](text: StringPiece, re_anchor: Anchor, consumed: i64*, // TODO: Pointer to `const Arg`. @@ -776,7 +776,7 @@ class RE2 { n: i32) -> bool; - fn ReverseProg[me: Self]() -> package.Prog*; + fn ReverseProg[self: Self]() -> package.Prog*; // string regular expression private var pattern_: String; @@ -853,30 +853,30 @@ class RE2.Arg { fn Make(nullptr) -> Self { return Make(nullptr as NullArg*); } interface Parseable { - fn Parse[addr me: Self*](str: StringView, n: i64) -> bool; + fn Parse[addr self: Self*](str: StringView, n: i64) -> bool; } match_first { impl [T:! Parse3ary] T as Parseable { - fn Parse[addr me: Self*](str: StringView, n: i64) -> bool { - return T.Parse(str, n, me); + fn Parse[addr self: Self*](str: StringView, n: i64) -> bool { + return T.Parse(str, n, self); } } impl [T:! Parse4ary] T as Parseable { - fn Parse[addr me: Self*](str: StringView, n: i64) -> bool { - return T.Parse(str, n, me, 10); + fn Parse[addr self: Self*](str: StringView, n: i64) -> bool { + return T.Parse(str, n, self, 10); } } impl [T:! ParseFrom] T as Parseable { - fn Parse[addr me: Self*](str: StringView, n: i64) -> bool { - if (me == nullptr) { return true; } - return T.Parse(str, n, me); + fn Parse[addr self: Self*](str: StringView, n: i64) -> bool { + if (self == nullptr) { return true; } + return T.Parse(str, n, self); } } } private class NullArg {} impl NullArg as Parseable { - fn Parse[addr me: Self*](str: StringView, n: i64) -> bool { + fn Parse[addr self: Self*](str: StringView, n: i64) -> bool { return true; } } @@ -885,8 +885,8 @@ class RE2.Arg { return {.type_ = T, .arg_ = ptr}; } - fn Parse[me: Self](str: StringView, n: i64) -> bool { - return me.arg_->Parse(str, n); + fn Parse[self: Self](str: StringView, n: i64) -> bool { + return self.arg_->Parse(str, n); } // TODO: Existential types or `DynPtr(Parseable)`. @@ -896,8 +896,8 @@ class RE2.Arg { private adapter ParseAsBase(T:! Parse4ary, base: i32) for T { impl as Self.Arg.Parseable { - fn Parse[addr me: Self*](str: StringView, n: i64) -> bool { - return T.Parse(str, n, me, base); + fn Parse[addr self: Self*](str: StringView, n: i64) -> bool { + return T.Parse(str, n, self, base); } } } @@ -938,12 +938,12 @@ class LazyRE2 { // Pretend to be a pointer to Type (never NULL due to on-demand creation): impl as Pointer where .Pointee = RE2 { - fn Resolve[me: Self]() -> Pointee* { return me.get(); } + fn Resolve[self: Self]() -> Pointee* { return self.get(); } } // Named accessor/initializer: - fn get[addr me: Self*]() -> RE* { - Cpp.std.call_once(once_, Self.Init, me); + fn get[addr self: Self*]() -> RE* { + Cpp.std.call_once(once_, Self.Init, self); return ptr_; } From 5be6b1de53a54a3645bf945c346b4b52cef2cd70 Mon Sep 17 00:00:00 2001 From: Josh L Date: Tue, 12 Jul 2022 20:57:59 +0000 Subject: [PATCH 03/20] Proposal --- proposals/p1382.md | 56 +++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/proposals/p1382.md b/proposals/p1382.md index 4dfca39883f16..f0567db4bba4e 100644 --- a/proposals/p1382.md +++ b/proposals/p1382.md @@ -15,7 +15,6 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - [Problem](#problem) - [Background](#background) - [Proposal](#proposal) -- [Details](#details) - [Rationale](#rationale) - [Alternatives considered](#alternatives-considered) @@ -23,42 +22,43 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ## Problem -TODO: What problem are you trying to solve? How important is that problem? Who -is impacted by it? +We've tried the `fn MethodName[me: Self]()` syntax for a while, and from our +experience the brevity of `me` is not worth doing something novel in this space. +We have found that `me` doesn't read well in practice. ## Background -TODO: Is there any background that readers should consider to fully understand -this problem and your approach to solving it? +The current method syntax, including these choices, was decided in +questions-for-leads issue +[#494: Method syntax](https://github.com/carbon-language/carbon-lang/issues/494). + +Looking at other languages that use reserved word for the receiver value: + +- C++ uses + [`this` for address of the receiver value](https://en.cppreference.com/w/cpp/language/this) +- Swift uses + [`self` for the receiver value](https://docs.swift.org/swift-book/LanguageGuide/Methods.html#ID238). + and + [`Self` for its type](https://docs.swift.org/swift-book/ReferenceManual/Types.html#ID610). +- Rust uses + [`self` for the receiver value](https://doc.rust-lang.org/std/keyword.self.html) + and + [`Self` for its type](https://doc.rust-lang.org/rust-by-example/fn/methods.html). +- C# uses + [`this` for a reference to the receiver value](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/this) ## Proposal -TODO: Briefly and at a high level, how do you propose to solve the problem? Why -will that in fact solve it? - -## Details - -TODO: Fully explain the details of the proposed solution. +Use `self` instead of `me` to be consistent with Swift and Rust. ## Rationale -TODO: How does this proposal effectively advance Carbon's goals? Rather than -re-stating the full motivation, this should connect that motivation back to -Carbon's stated goals and principles. This may evolve during review. Use links -to appropriate sections of [`/docs/project/goals.md`](/docs/project/goals.md), -and/or to documents in [`/docs/project/principles`](/docs/project/principles). -For example: - -- [Community and culture](/docs/project/goals.md#community-and-culture) -- [Language tools and ecosystem](/docs/project/goals.md#language-tools-and-ecosystem) -- [Performance-critical software](/docs/project/goals.md#performance-critical-software) -- [Software and language evolution](/docs/project/goals.md#software-and-language-evolution) -- [Code that is easy to read, understand, and write](/docs/project/goals.md#code-that-is-easy-to-read-understand-and-write) -- [Practical safety and testing mechanisms](/docs/project/goals.md#practical-safety-and-testing-mechanisms) -- [Fast and scalable development](/docs/project/goals.md#fast-and-scalable-development) -- [Modern OS platforms, hardware architectures, and environments](/docs/project/goals.md#modern-os-platforms-hardware-architectures-and-environments) -- [Interoperability with and migration from existing C++ code](/docs/project/goals.md#interoperability-with-and-migration-from-existing-c-code) +This is consistent with Carbon's goal to make +[Code that is easy to read, understand, and write](/docs/project/goals.md#code-that-is-easy-to-read-understand-and-write) +by choosing a keyword for this role that is less surprising to users. ## Alternatives considered -TODO: What alternative solutions have you considered? +We could also switch to `this`, but we are worried that it frequently not being +a pointer would be surprising to the C++ users that choice would be intended to +benefit. From 376c381cfd47b8ce3f3eff05b0c5ee4e2b1715d1 Mon Sep 17 00:00:00 2001 From: Josh L Date: Tue, 12 Jul 2022 21:38:08 +0000 Subject: [PATCH 04/20] Add table to proposal text --- proposals/p1382.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/proposals/p1382.md b/proposals/p1382.md index f0567db4bba4e..959f77d66185d 100644 --- a/proposals/p1382.md +++ b/proposals/p1382.md @@ -34,6 +34,21 @@ questions-for-leads issue Looking at other languages that use reserved word for the receiver value: +| Year | Language | Parameter in signature | Receiver value | Receiver type | +| ---- | ---------- | ---------------------- | -------------- | ------------- | +| 1983 | C++ | implicit | `this` | --- | +| 1991 | Python | explicit | `self` | --- | +| 1995 | Java | implicit | `this` | --- | +| 1995 | JavaScript | explicit | `this` | --- | +| 2000 | C# | implicit | `this` | --- | +| 2009 | Go | explicit | --- | --- | +| 2010 | Rust | explicit | `self` | `Self` | +| 2011 | Kotlin | implicit | `this` | --- | +| 2012 | TypeScript | explicit | `this` | `this` | +| 2014 | Swift | implicit | `self` | `Self` | + +In detail: + - C++ uses [`this` for address of the receiver value](https://en.cppreference.com/w/cpp/language/this) - Swift uses @@ -46,6 +61,9 @@ Looking at other languages that use reserved word for the receiver value: [`Self` for its type](https://doc.rust-lang.org/rust-by-example/fn/methods.html). - C# uses [`this` for a reference to the receiver value](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/this) +- Python as a convention uses `self` for the receiver value, but it's almost + universally followed. +- Go conventionally uses an abbreviation of the type name. ## Proposal From 095e22e129bc3846073a483793b236101ab013f2 Mon Sep 17 00:00:00 2001 From: Josh L Date: Tue, 12 Jul 2022 21:41:26 +0000 Subject: [PATCH 05/20] Fix column --- proposals/p1382.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/proposals/p1382.md b/proposals/p1382.md index 959f77d66185d..48e79a106f363 100644 --- a/proposals/p1382.md +++ b/proposals/p1382.md @@ -34,18 +34,18 @@ questions-for-leads issue Looking at other languages that use reserved word for the receiver value: -| Year | Language | Parameter in signature | Receiver value | Receiver type | -| ---- | ---------- | ---------------------- | -------------- | ------------- | -| 1983 | C++ | implicit | `this` | --- | -| 1991 | Python | explicit | `self` | --- | -| 1995 | Java | implicit | `this` | --- | -| 1995 | JavaScript | explicit | `this` | --- | -| 2000 | C# | implicit | `this` | --- | -| 2009 | Go | explicit | --- | --- | -| 2010 | Rust | explicit | `self` | `Self` | -| 2011 | Kotlin | implicit | `this` | --- | -| 2012 | TypeScript | explicit | `this` | `this` | -| 2014 | Swift | implicit | `self` | `Self` | +| Year | Language | Receiver when accessing members | Receiver value | Receiver type | +| ---- | ---------- | ------------------------------- | -------------- | ------------- | +| 1983 | C++ | implicit | `this` | --- | +| 1991 | Python | explicit | `self` | --- | +| 1995 | Java | implicit | `this` | --- | +| 1995 | JavaScript | explicit | `this` | --- | +| 2000 | C# | implicit | `this` | --- | +| 2009 | Go | explicit | --- | --- | +| 2010 | Rust | explicit | `self` | `Self` | +| 2011 | Kotlin | implicit | `this` | --- | +| 2012 | TypeScript | explicit | `this` | `this` | +| 2014 | Swift | implicit | `self` | `Self` | In detail: From 04f3727d94acf5b998fef751963d6756fd925437 Mon Sep 17 00:00:00 2001 From: Josh L Date: Tue, 12 Jul 2022 21:44:30 +0000 Subject: [PATCH 06/20] Add Carbon to the table --- proposals/p1382.md | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/proposals/p1382.md b/proposals/p1382.md index 48e79a106f363..93647d3b312e5 100644 --- a/proposals/p1382.md +++ b/proposals/p1382.md @@ -34,18 +34,20 @@ questions-for-leads issue Looking at other languages that use reserved word for the receiver value: -| Year | Language | Receiver when accessing members | Receiver value | Receiver type | -| ---- | ---------- | ------------------------------- | -------------- | ------------- | -| 1983 | C++ | implicit | `this` | --- | -| 1991 | Python | explicit | `self` | --- | -| 1995 | Java | implicit | `this` | --- | -| 1995 | JavaScript | explicit | `this` | --- | -| 2000 | C# | implicit | `this` | --- | -| 2009 | Go | explicit | --- | --- | -| 2010 | Rust | explicit | `self` | `Self` | -| 2011 | Kotlin | implicit | `this` | --- | -| 2012 | TypeScript | explicit | `this` | `this` | -| 2014 | Swift | implicit | `self` | `Self` | +| Year | Language | Receiver when accessing members | Receiver value | Receiver type | +| ---------- | ---------- | ------------------------------- | -------------- | ------------- | +| 1983 | C++ | implicit | `this` | --- | +| 1991 | Python | explicit | `self` | --- | +| 1995 | Java | implicit | `this` | --- | +| 1995 | JavaScript | explicit | `this` | --- | +| 2000 | C# | implicit | `this` | --- | +| 2009 | Go | explicit | --- | --- | +| 2010 | Rust | explicit | `self` | `Self` | +| 2011 | Kotlin | implicit | `this` | --- | +| 2012 | TypeScript | explicit | `this` | `this` | +| 2014 | Swift | implicit | `self` | `Self` | +| previously | Carbon | explicit | `me` | `Self` | +| proposed | Carbon | explicit | `self` | `Self` | In detail: From 5e54440b2eea1088b224127cdc0a324f0048079a Mon Sep 17 00:00:00 2001 From: Josh L Date: Wed, 13 Jul 2022 20:16:50 +0000 Subject: [PATCH 07/20] Status quo alternative --- proposals/p1382.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/proposals/p1382.md b/proposals/p1382.md index 93647d3b312e5..ea984d1201ddb 100644 --- a/proposals/p1382.md +++ b/proposals/p1382.md @@ -79,6 +79,11 @@ by choosing a keyword for this role that is less surprising to users. ## Alternatives considered +We could stay with the status quo, though as the chart in +[the background section](#background) shows other languages have found it +acceptable to require a 4 character explicit keyword for accessing members of +the current object. + We could also switch to `this`, but we are worried that it frequently not being a pointer would be surprising to the C++ users that choice would be intended to benefit. From 26246f1602835ce7f34767b76438dd382a817279 Mon Sep 17 00:00:00 2001 From: Josh L Date: Wed, 13 Jul 2022 20:28:34 +0000 Subject: [PATCH 08/20] Clarify go-lang --- proposals/p1382.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/p1382.md b/proposals/p1382.md index ea984d1201ddb..e007718ed7396 100644 --- a/proposals/p1382.md +++ b/proposals/p1382.md @@ -41,7 +41,7 @@ Looking at other languages that use reserved word for the receiver value: | 1995 | Java | implicit | `this` | --- | | 1995 | JavaScript | explicit | `this` | --- | | 2000 | C# | implicit | `this` | --- | -| 2009 | Go | explicit | --- | --- | +| 2009 | Go | explicit | (see below) | --- | | 2010 | Rust | explicit | `self` | `Self` | | 2011 | Kotlin | implicit | `this` | --- | | 2012 | TypeScript | explicit | `this` | `this` | From 750850b07991229910533b312d6aec10ae5ea7d6 Mon Sep 17 00:00:00 2001 From: Josh L Date: Sat, 23 Jul 2022 16:03:22 +0000 Subject: [PATCH 09/20] Polish rationale, address concerns about length in signature --- proposals/p1382.md | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/proposals/p1382.md b/proposals/p1382.md index e007718ed7396..cedc0e90c3789 100644 --- a/proposals/p1382.md +++ b/proposals/p1382.md @@ -17,6 +17,8 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - [Proposal](#proposal) - [Rationale](#rationale) - [Alternatives considered](#alternatives-considered) + - [Don't change anything](#dont-change-anything) + - [`this`](#this) @@ -30,7 +32,9 @@ We have found that `me` doesn't read well in practice. The current method syntax, including these choices, was decided in questions-for-leads issue -[#494: Method syntax](https://github.com/carbon-language/carbon-lang/issues/494). +[#494: Method syntax](https://github.com/carbon-language/carbon-lang/issues/494) +and implemented in proposal +[#722: Nominal classes and methods](https://github.com/carbon-language/carbon-lang/pull/722). Looking at other languages that use reserved word for the receiver value: @@ -79,11 +83,26 @@ by choosing a keyword for this role that is less surprising to users. ## Alternatives considered -We could stay with the status quo, though as the chart in -[the background section](#background) shows other languages have found it -acceptable to require a 4 character explicit keyword for accessing members of -the current object. - -We could also switch to `this`, but we are worried that it frequently not being -a pointer would be surprising to the C++ users that choice would be intended to -benefit. +### Don't change anything + +We could stay with the status quo, which has the benefit that `me` is shorter +than `self`. There are two considerations: + +- For accessing members of the current object, the chart in + [the background section](#background) shows plenty of precedent for + requiring a 4 character explicit keyword. +- We would also like to reduce ceremony when declaring the signature of a + method. For this concern, both `me: Self` and `addr me: Self*` are already + longer than what other languages use in practice. It would probably be + better to solve this problem with a shortcut approach like Rust + ([1](https://doc.rust-lang.org/book/ch05-03-method-syntax.html), + [2](https://doc.rust-lang.org/rust-by-example/fn/methods.html)), where + `&self` is short for `self: &Self` and `&mut self` is short for + `self: &mut Self`. + +### `this` + +We could also switch to `this`, primarily to benefit +[C++ users](https://en.cppreference.com/w/cpp/language/this). However, we are +worried that it frequently not being a pointer would be surprising to those C++ +users. From 0c2ebf138c8832b242a0c32fb72bdf0cca0c0088 Mon Sep 17 00:00:00 2001 From: Josh L Date: Sat, 23 Jul 2022 16:05:47 +0000 Subject: [PATCH 10/20] Make `self` a keyword --- docs/design/lexical_conventions/words.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/design/lexical_conventions/words.md b/docs/design/lexical_conventions/words.md index 4e42faec8036a..c2fd8befb78bd 100644 --- a/docs/design/lexical_conventions/words.md +++ b/docs/design/lexical_conventions/words.md @@ -76,6 +76,7 @@ The following words are interpreted as keywords: - `protected` - `return` - `returned` +- `self` - `then` - `var` - `virtual` From 00b2ffb3e396cdc1d7519067117407415ec3d6ed Mon Sep 17 00:00:00 2001 From: Josh L Date: Sat, 23 Jul 2022 16:30:03 +0000 Subject: [PATCH 11/20] Fix recent changes introducing more `me` references --- docs/design/README.md | 2 +- explorer/data/prelude.carbon | 6 +++--- explorer/testdata/as/convert.carbon | 2 +- explorer/testdata/as/implicit_as.carbon | 2 +- .../testdata/assoc_const/fail_multiple_deduction.carbon | 2 +- explorer/testdata/assoc_const/impl_lookup.carbon | 6 +++--- explorer/testdata/assoc_const/simple_constraint.carbon | 4 ++-- explorer/testdata/assoc_const/simple_equality.carbon | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/design/README.md b/docs/design/README.md index e61185ff2ed21..dc79a38d83e5a 100644 --- a/docs/design/README.md +++ b/docs/design/README.md @@ -1604,7 +1604,7 @@ For every type `MyClass`, there is the type `const MyClass` such that: - If member `x` of `MyClass` has type `T`, then member `x` of `const MyClass` has type `const T`. - The API of a `const MyClass` is a subset of `MyClass`, excluding all methods - taking `[addr me: Self*]`. + taking `[addr self: Self*]`. Note that `const` binds more tightly than postfix-`*` for forming a pointer type, so `const MyClass*` is equal to `(const MyClass)*`. diff --git a/explorer/data/prelude.carbon b/explorer/data/prelude.carbon index 87e68be410384..2c4bde64fa569 100644 --- a/explorer/data/prelude.carbon +++ b/explorer/data/prelude.carbon @@ -6,7 +6,7 @@ package Carbon api; // Explicitly convert `Self` to `T`. interface As(T:! Type) { - fn Convert[me: Self]() -> T; + fn Convert[self: Self]() -> T; } // Implicitly convert `Self` to `T`. @@ -16,12 +16,12 @@ interface ImplicitAs(T:! Type) { // TODO: ImplicitAs(T) should extend As(T). impl forall [T:! Type, U:! ImplicitAs(T)] U as As(T) { - fn Convert[me: Self]() -> T { return me.Convert(); } + fn Convert[self: Self]() -> T { return self.Convert(); } } // Every type implicitly converts to itself. impl forall [T:! Type] T as ImplicitAs(T) { - fn Convert[me: Self]() -> T { return me; } + fn Convert[self: Self]() -> T { return self; } } // TODO: Simplify this once we have variadics. diff --git a/explorer/testdata/as/convert.carbon b/explorer/testdata/as/convert.carbon index 0e71efeca6774..8d1e2a2c6de35 100644 --- a/explorer/testdata/as/convert.carbon +++ b/explorer/testdata/as/convert.carbon @@ -14,7 +14,7 @@ package ExplorerTest api; class A { var n: i32; } external impl A as As(i32) { - fn Convert[me: Self]() -> i32 { return me.n; } + fn Convert[self: Self]() -> i32 { return self.n; } } fn Main() -> i32 { diff --git a/explorer/testdata/as/implicit_as.carbon b/explorer/testdata/as/implicit_as.carbon index d2cd3b5aec69d..9e6e85709a348 100644 --- a/explorer/testdata/as/implicit_as.carbon +++ b/explorer/testdata/as/implicit_as.carbon @@ -14,7 +14,7 @@ package ExplorerTest api; class A { var n: i32; } external impl A as ImplicitAs(i32) { - fn Convert[me: Self]() -> i32 { return me.n; } + fn Convert[self: Self]() -> i32 { return self.n; } } fn Main() -> i32 { diff --git a/explorer/testdata/assoc_const/fail_multiple_deduction.carbon b/explorer/testdata/assoc_const/fail_multiple_deduction.carbon index 7c36edf00848f..61c14b09daa1e 100644 --- a/explorer/testdata/assoc_const/fail_multiple_deduction.carbon +++ b/explorer/testdata/assoc_const/fail_multiple_deduction.carbon @@ -14,7 +14,7 @@ interface HasThreeTypes { let A:! Type; let B:! Type; let C:! Type; - fn Make[me: Self]() -> (A, B, C); + fn Make[self: Self]() -> (A, B, C); } fn F[T:! Type](x: (T, T, T)); fn G[X:! HasThreeTypes where .A == .B and .B == .C and .C == .A](x: X) { diff --git a/explorer/testdata/assoc_const/impl_lookup.carbon b/explorer/testdata/assoc_const/impl_lookup.carbon index 542fa80daec63..e7731c0c98536 100644 --- a/explorer/testdata/assoc_const/impl_lookup.carbon +++ b/explorer/testdata/assoc_const/impl_lookup.carbon @@ -13,7 +13,7 @@ package ExplorerTest api; interface Frob { let Result:! Type; - fn F[me: Self]() -> Result; + fn F[self: Self]() -> Result; } fn Use[T:! Frob](x: T) -> T.Result { @@ -24,12 +24,12 @@ fn Use[T:! Frob](x: T) -> T.Result { class AlmostI32 { var val: i32; impl as ImplicitAs(i32) { - fn Convert[me: Self]() -> i32 { return me.val; } + fn Convert[self: Self]() -> i32 { return self.val; } } } impl i32 as Frob where .Result == AlmostI32 { - fn F[me: Self]() -> AlmostI32 { return {.val = me}; } + fn F[self: Self]() -> AlmostI32 { return {.val = self}; } } fn Main() -> i32 { diff --git a/explorer/testdata/assoc_const/simple_constraint.carbon b/explorer/testdata/assoc_const/simple_constraint.carbon index e6998b8e86bca..5f9ccfc13f7d0 100644 --- a/explorer/testdata/assoc_const/simple_constraint.carbon +++ b/explorer/testdata/assoc_const/simple_constraint.carbon @@ -13,7 +13,7 @@ package ExplorerTest api; interface Frob { let Result:! Type; - fn F[me: Self]() -> Result; + fn F[self: Self]() -> Result; } fn Use[T:! Frob where .Result == .Self](x: T) -> T { @@ -22,7 +22,7 @@ fn Use[T:! Frob where .Result == .Self](x: T) -> T { } impl i32 as Frob where .Result == i32 { - fn F[me: Self]() -> i32 { return me + 1; } + fn F[self: Self]() -> i32 { return self + 1; } } fn Main() -> i32 { diff --git a/explorer/testdata/assoc_const/simple_equality.carbon b/explorer/testdata/assoc_const/simple_equality.carbon index 25736ebda1b3a..dde8ae2c533e6 100644 --- a/explorer/testdata/assoc_const/simple_equality.carbon +++ b/explorer/testdata/assoc_const/simple_equality.carbon @@ -13,7 +13,7 @@ package ExplorerTest api; interface Frob { let Result:! Type; - fn F[me: Self]() -> Result; + fn F[self: Self]() -> Result; } fn Use[T:! Frob](x: T) -> T.Result { @@ -22,7 +22,7 @@ fn Use[T:! Frob](x: T) -> T.Result { } impl i32 as Frob where .Result == i32 { - fn F[me: Self]() -> i32 { return 0; } + fn F[self: Self]() -> i32 { return 0; } } fn Main() -> i32 { From 70ab6097a527dffe5f94d5780b211c9861e2f24a Mon Sep 17 00:00:00 2001 From: Josh L Date: Sat, 23 Jul 2022 16:36:24 +0000 Subject: [PATCH 12/20] Update fuzzing --- common/fuzzing/carbon.proto | 2 +- common/fuzzing/proto_to_carbon.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/common/fuzzing/carbon.proto b/common/fuzzing/carbon.proto index 0f48dc844966a..49b50d74a3518 100644 --- a/common/fuzzing/carbon.proto +++ b/common/fuzzing/carbon.proto @@ -327,7 +327,7 @@ message ReturnTerm { message FunctionDeclaration { optional string name = 1; repeated GenericBinding deduced_parameters = 2; - optional Pattern me_pattern = 3; + optional Pattern self_pattern = 3; optional TuplePattern param_pattern = 4; optional ReturnTerm return_term = 5; optional BlockStatement body = 6; diff --git a/common/fuzzing/proto_to_carbon.cpp b/common/fuzzing/proto_to_carbon.cpp index 06d6630677c53..bd937311f31fe 100644 --- a/common/fuzzing/proto_to_carbon.cpp +++ b/common/fuzzing/proto_to_carbon.cpp @@ -650,17 +650,18 @@ static auto DeclarationToCarbon(const Fuzzing::Declaration& declaration, out << "fn "; IdentifierToCarbon(function.name(), out); - if (!function.deduced_parameters().empty() || function.has_me_pattern()) { + if (!function.deduced_parameters().empty() || + function.has_self_pattern()) { out << "["; llvm::ListSeparator sep; for (const Fuzzing::GenericBinding& p : function.deduced_parameters()) { out << sep; GenericBindingToCarbon(p, out); } - if (function.has_me_pattern()) { + if (function.has_self_pattern()) { // This is a class method. out << sep; - PatternToCarbon(function.me_pattern(), out); + PatternToCarbon(function.self_pattern(), out); } out << "]"; } From 5e8a646d8977eb5820bd16f63186dd75252a669c Mon Sep 17 00:00:00 2001 From: Josh L Date: Sat, 23 Jul 2022 16:52:45 +0000 Subject: [PATCH 13/20] Fix me_pattern -> self_pattern --- explorer/ast/declaration.h | 10 +++++----- explorer/fuzzing/ast_to_proto.cpp | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/explorer/ast/declaration.h b/explorer/ast/declaration.h index b975a0e8bd38c..39c5870ed4529 100644 --- a/explorer/ast/declaration.h +++ b/explorer/ast/declaration.h @@ -123,7 +123,7 @@ class FunctionDeclaration : public Declaration { : Declaration(AstNodeKind::FunctionDeclaration, source_loc), name_(std::move(name)), deduced_parameters_(std::move(deduced_params)), - me_pattern_(self_pattern), + self_pattern_(self_pattern), param_pattern_(param_pattern), return_term_(return_term), body_(body) {} @@ -142,8 +142,8 @@ class FunctionDeclaration : public Declaration { auto deduced_parameters() -> llvm::ArrayRef> { return deduced_parameters_; } - auto self_pattern() const -> const Pattern& { return **me_pattern_; } - auto self_pattern() -> Pattern& { return **me_pattern_; } + auto self_pattern() const -> const Pattern& { return **self_pattern_; } + auto self_pattern() -> Pattern& { return **self_pattern_; } auto param_pattern() const -> const TuplePattern& { return *param_pattern_; } auto param_pattern() -> TuplePattern& { return *param_pattern_; } auto return_term() const -> const ReturnTerm& { return return_term_; } @@ -153,12 +153,12 @@ class FunctionDeclaration : public Declaration { auto value_category() const -> ValueCategory { return ValueCategory::Let; } - auto is_method() const -> bool { return me_pattern_.has_value(); } + auto is_method() const -> bool { return self_pattern_.has_value(); } private: std::string name_; std::vector> deduced_parameters_; - std::optional> me_pattern_; + std::optional> self_pattern_; Nonnull param_pattern_; ReturnTerm return_term_; std::optional> body_; diff --git a/explorer/fuzzing/ast_to_proto.cpp b/explorer/fuzzing/ast_to_proto.cpp index 62078ad3cff48..80a2aae7e19f5 100644 --- a/explorer/fuzzing/ast_to_proto.cpp +++ b/explorer/fuzzing/ast_to_proto.cpp @@ -546,11 +546,11 @@ static auto DeclarationToProto(const Declaration& declaration) if (function.is_method()) { switch (function.self_pattern().kind()) { case PatternKind::AddrPattern: - *function_proto->mutable_me_pattern() = + *function_proto->mutable_self_pattern() = PatternToProto(cast(function.self_pattern())); break; case PatternKind::BindingPattern: - *function_proto->mutable_me_pattern() = + *function_proto->mutable_self_pattern() = PatternToProto(cast(function.self_pattern())); break; default: From 2d077b1ee2ba41a117930861026646bcc148813f Mon Sep 17 00:00:00 2001 From: Josh L Date: Sat, 23 Jul 2022 18:28:06 +0000 Subject: [PATCH 14/20] Table touch ups --- proposals/p1382.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/proposals/p1382.md b/proposals/p1382.md index cedc0e90c3789..477b8c68a2544 100644 --- a/proposals/p1382.md +++ b/proposals/p1382.md @@ -38,20 +38,20 @@ and implemented in proposal Looking at other languages that use reserved word for the receiver value: -| Year | Language | Receiver when accessing members | Receiver value | Receiver type | -| ---------- | ---------- | ------------------------------- | -------------- | ------------- | -| 1983 | C++ | implicit | `this` | --- | -| 1991 | Python | explicit | `self` | --- | -| 1995 | Java | implicit | `this` | --- | -| 1995 | JavaScript | explicit | `this` | --- | -| 2000 | C# | implicit | `this` | --- | -| 2009 | Go | explicit | (see below) | --- | -| 2010 | Rust | explicit | `self` | `Self` | -| 2011 | Kotlin | implicit | `this` | --- | -| 2012 | TypeScript | explicit | `this` | `this` | -| 2014 | Swift | implicit | `self` | `Self` | -| previously | Carbon | explicit | `me` | `Self` | -| proposed | Carbon | explicit | `self` | `Self` | +| When | Language | Receiver when
accessing members | Receiver value | Receiver type | +| ---------- | ---------- | ------------------------------------ | -------------- | ------------- | +| 1983 | C++ | implicit | `this` | --- | +| 1991 | Python | explicit | `self` | --- | +| 1995 | Java | implicit | `this` | --- | +| 1995 | JavaScript | explicit | `this` | --- | +| 2000 | C# | implicit | `this` | --- | +| 2009 | Go | explicit | (see below) | --- | +| 2010 | Rust | explicit | `self` | `Self` | +| 2011 | Kotlin | implicit | `this` | --- | +| 2012 | TypeScript | explicit | `this` | `this` | +| 2014 | Swift | implicit | `self` | `Self` | +| previously | Carbon | explicit | `me` | `Self` | +| proposed | Carbon | explicit | `self` | `Self` | In detail: From ca8a8b541a804700d299677f60970a47a2e4f706 Mon Sep 17 00:00:00 2001 From: Josh L Date: Sat, 23 Jul 2022 21:35:47 +0000 Subject: [PATCH 15/20] Undo implementation of proposal, now in #1624 --- common/fuzzing/carbon.proto | 2 +- common/fuzzing/proto_to_carbon.cpp | 7 +- docs/design/README.md | 56 +- docs/design/classes.md | 72 +- docs/design/expressions/README.md | 4 +- docs/design/expressions/arithmetic.md | 12 +- docs/design/expressions/as_expressions.md | 2 +- docs/design/expressions/bitwise.md | 12 +- .../expressions/comparison_operators.md | 58 +- .../expressions/implicit_conversions.md | 2 +- docs/design/expressions/member_access.md | 44 +- docs/design/generics/appendix-coherence.md | 4 +- docs/design/generics/details.md | 466 +++---- docs/design/generics/overview.md | 36 +- docs/design/generics/terminology.md | 14 +- docs/design/lexical_conventions/words.md | 1 - docs/design/templates.md | 4 +- explorer/ast/declaration.cpp | 20 +- explorer/ast/declaration.h | 14 +- explorer/ast/expression.h | 2 +- explorer/data/prelude.carbon | 24 +- explorer/fuzzing/ast_to_proto.cpp | 19 +- .../07c99567d27dcd6d7046c7dd7c12f09c2ddf2c9e | 300 ----- .../091bf8f8567d807470ee5ef92b2b8659a0dfdfc3 | 857 ------------- .../0c1ae47ddcb696f04e02513d439f4a54921f08f3 | 645 ---------- .../10262aa9c545ac25ae1cd7ccd0cdd7ad758ad1d8 | 183 --- .../11d859d1c6b9ea0262e5fab224758bd6c34bed14 | 1104 ---------------- .../1691a7876803b03fa4e932b9e4b3cd370910b27c | 700 ---------- .../1b50f0f95f834081ac26a707b5ed161079fac7a9 | 1098 ---------------- .../26dc885153b426df9c1695ccd09a152eb39d744e | 805 ------------ .../281e1ca9619c28362d8674aceda9fff50b3892fb | 233 ---- .../2b19e350556fbbc1d4821da650b3cf0d17148ae9 | 270 ---- .../2b3791b3cd55ea889bb2ab7c54571506788e1ca9 | 766 ----------- .../304589d53b5ac70ae5b20bfb211e9ef2ef89c303 | 247 ---- .../3090c90b834514f4dd338c2a22b63c25beb347c5 | 411 ------ .../309601c5d0e404307e368b2582e13e55f6d51b1d | 645 ---------- .../35de79f70854c62b8f4b02abb8877d7277f2e961 | 645 ---------- .../3bc84abaa7693f3ca0f0681f6f1097e1766d9d89 | 293 ----- .../3ed8ca560ef34c454714552d051ec8d184dda8c3 | 218 ---- .../46e4b415ad8248b7aeeaad245c8f541253193949 | 571 --------- .../47c8ce5c9e3190017234541803e0cb4df63a7813 | 345 ----- .../48b1435c9df1e717046e6287b58fa56443ed1811 | 669 ---------- .../4e336ef2a037f5b85a70defee2016d0e82ebde61 | 465 ------- .../503c9b96ee1cc78e58ec9b362db2bdac5e941119 | 324 ----- .../54e9c97b2f7561cc205bc243927d1dbbbf753c16 | 588 --------- .../5ad39cbb562bed711f6d6e8d44b631cb25881673 | 567 --------- .../5b0eabed769a089e9906772fe0dfc78b111fee38 | 110 -- .../5f24e26f9bfacd281bc23e93f1cbdcb144743057 | 855 ------------- .../60d9b88eed255b0805f08ead84037690c554182b | 294 ----- .../6318884693dd31430b4b46b1305dae63f281751e | 164 --- .../68a5800e6a2dbe2f732129fe874f20bbb42b90b5 | 180 --- .../6a879cdde713ac9009864ed5f9912616d314e017 | 309 ----- .../6b308c0cf9835a750f16ee9aad989601b18c750b | 1124 ----------------- .../6c25c16bd50745570b78bee439871f5d6a0ca621 | 283 ----- .../6cda920c7329398b3d5b3766b83c8deed3dc835c | 305 ----- .../7157552a4bd3e30351e21e9a9139d8379ef34eb0 | 418 ------ .../761eaa907a94fe001f6b5e31159f0b6c4ef171d8 | 669 ---------- .../781ecc36990e2394a0c6823855c583aae691bc78 | 151 --- .../8656cefeac8b03c9c7f2073d4811a04d69b83ec8 | 402 ------ .../8c090ae94a3fdb5c70d49a69b7f6d0ac1cec7fdf | 694 ---------- .../910b0bf2a2d9eae7d81ff57e0f451282e869d1ed | 244 ---- .../91e7c6b8d14f7d5a82076f29ac5cc135b27e1829 | 383 ------ .../93520a24f7e183a277cd67f30907e0c979969e00 | 645 ---------- .../981655702b85acf10978cdb81df86b9399788092 | 245 ---- .../9f1a867accead08d789b8f7d6b3b7303a643bbc2 | 805 ------------ .../ac929314f700519e9c008f6e2817910c067c949b | 174 --- .../b140b427aeef91089568f3b775bd4683bfad5c0e | 324 ----- .../b1f2cfe33f8d50f38ce8addd62b76519bd589d9e | 82 -- .../b8e05ecd5da75a6af34295d2396d27fec1cfd4d5 | 200 --- .../be2a3f66b52634d15b9e34c0ed93ce8ffebcd527 | 228 ---- .../bfa6ce9868e4fb4c6ddbc3f922c010261084f3a5 | 495 -------- .../c2646dc4add2384ca4c733a9a706b218397cc1c8 | 174 --- .../c578992c249bcfb9ce98c775fee12bba7d7af36d | 623 --------- .../c593c6692ed2ef06d7d2749add94d4ebd91dbba7 | 505 -------- .../c769fdc8c81040b10176d937e9fea824e17b065f | 679 ---------- .../caf0048f803af5a515f0ebff6140d6e2ee52e8fb | 768 ----------- .../cd181298508a398cacb7dd4bd4eb75c14a8dd3e0 | 374 ------ .../ce85fb106849dde89ccc11e6ff799faa8c74af07 | 257 ---- .../ce8a72d8214224c0cf6cd1208452aa86ddb41a3c | 283 ----- .../cea671bbabe96758d652ca6d207eb04a82e64923 | 266 ---- .../ced66b30c1335523b9a066db3186ae300174d643 | 686 ---------- .../d1e5a00347368e94959ff07b93e4c6a0762091a8 | 124 -- .../dcd20be9b4193f2a2d428ca170d06e8f15066572 | 403 ------ .../e18e54955a7d12d8676a628f6a8a2a700d09394d | 126 -- .../e29450683541d9d7ed77043b5bccc8e845fe909e | 976 -------------- .../e3b3b1f52b6d35189726bae3b49d358f1eda35d6 | 161 --- .../e6c980db2dc247d290d0bef72b045ddb3bc9e712 | 283 ----- .../e9715683bb49b068d7e5848a6afa8ad6ad71bf07 | 325 ----- .../eeffdec7cdffe7258413447330e745427673be5b | 223 ---- .../ef9e4ddee87e9a1551d2cf0f56c2b2698d6000c0 | 283 ----- .../fcbce51b08fb96910190bccab95620d12d64e5e2 | 120 -- .../fddfbdab89dbe1de7488636e4f664617ab2bbb68 | 614 --------- .../ff3fae0020f618948885ab71526d70ec25893935 | 712 ----------- .../ff8a441cec416ebb3de16074ce2e864cab65cf16 | 565 --------- explorer/interpreter/impl_scope.h | 4 +- explorer/interpreter/interpreter.cpp | 4 +- explorer/interpreter/resolve_names.cpp | 2 +- explorer/interpreter/type_checker.cpp | 13 +- explorer/interpreter/value.h | 2 +- explorer/testdata/addr/fail-method-let.carbon | 6 +- .../addr/fail-method-self-type.carbon | 41 - explorer/testdata/addr/method.carbon | 6 +- explorer/testdata/addr/nested-method.carbon | 6 +- explorer/testdata/alias/class_alias.carbon | 6 +- .../testdata/alias/member_name_alias.carbon | 8 +- explorer/testdata/as/convert.carbon | 2 +- explorer/testdata/as/implicit_as.carbon | 2 +- explorer/testdata/assign/convert_rhs.carbon | 2 +- .../fail_multiple_deduction.carbon | 2 +- .../testdata/assoc_const/impl_lookup.carbon | 6 +- .../assoc_const/simple_constraint.carbon | 4 +- .../assoc_const/simple_equality.carbon | 4 +- explorer/testdata/class/bound_method.carbon | 4 +- explorer/testdata/class/empty_class.carbon | 2 +- .../testdata/class/fail_method_deduced.carbon | 2 +- .../class/fail_method_from_class.carbon | 4 +- .../testdata/class/fail_method_in_var.carbon | 2 +- .../testdata/class/fail_return_method.carbon | 2 +- explorer/testdata/class/method.carbon | 4 +- .../testdata/class/method_call_method.carbon | 8 +- explorer/testdata/class/method_self.carbon | 4 +- .../testdata/constraint/binding_self.carbon | 4 +- .../testdata/constraint/where_self.carbon | 4 +- .../convert_run.carbon | 4 +- .../testdata/function/convert_args.carbon | 6 +- .../generic_class/class_function.carbon | 4 +- .../generic_class/fail_args_mismatch.carbon | 4 +- .../fail_bad_parameter_type.carbon | 4 +- .../generic_class/fail_no_args.carbon | 4 +- .../generic_class/fail_self_with_arg.carbon | 4 +- .../generic_class/fail_two_arg_lists.carbon | 4 +- .../generic_class_substitution.carbon | 4 +- .../generic_fun_and_class.carbon | 4 +- .../generic_class/generic_point.carbon | 4 +- .../generic_class/impl_with_argument.carbon | 12 +- .../generic_class/impl_with_self.carbon | 12 +- .../param_with_dependent_type.carbon | 2 +- .../generic_class/point_with_interface.carbon | 12 +- .../testdata/generic_class/use_self.carbon | 4 +- .../generic_function/generic_method.carbon | 10 +- .../implicit_conversion.carbon | 4 +- .../implicit_conversion.carbon | 2 +- .../testdata/if_else/convert_condition.carbon | 4 +- .../if_expression/convert_condition.carbon | 4 +- .../testdata/impl/fail_ambiguous_impl.carbon | 20 +- .../impl/fail_unambiguous_impl_generic.carbon | 20 +- .../testdata/impl/generic_method_impl.carbon | 14 +- .../impl/impl_in_generic_class.carbon | 4 +- explorer/testdata/impl/param_impl.carbon | 8 +- explorer/testdata/impl/param_impl2.carbon | 8 +- .../testdata/impl/param_impl_with_self.carbon | 8 +- .../testdata/interface/class_function.carbon | 12 +- .../interface/constrained_parameter.carbon | 28 +- .../external_impl_point_vector.carbon | 12 +- .../interface/external_impl_use_self.carbon | 12 +- .../fail_external_impl_omit_self.carbon | 12 +- .../interface/fail_external_impl_self.carbon | 12 +- .../interface/fail_impl_bad_member.carbon | 10 +- .../interface/fail_impl_missing_member.carbon | 8 +- .../fail_interface_missing_member.carbon | 6 +- .../testdata/interface/fail_no_impl.carbon | 4 +- .../interface/generic_call_generic.carbon | 12 +- .../interface/generic_with_two_params.carbon | 20 +- .../impl_self_interface_parameter.carbon | 6 +- explorer/testdata/interface/omit_self.carbon | 12 +- .../param_with_dependent_type.carbon | 4 +- .../testdata/interface/parameterized.carbon | 12 +- .../interface/tuple_vector_add_scale.carbon | 12 +- .../interface/vector_point_add_scale.carbon | 12 +- explorer/testdata/interface/with_self.carbon | 12 +- explorer/testdata/let/fail_method_args.carbon | 2 +- .../testdata/let/implicit_conversion.carbon | 2 +- .../let/implicit_conversion_choice.carbon | 2 +- explorer/testdata/match/convert.carbon | 2 +- .../match/fail_pattern_type_mismatch.carbon | 2 +- .../member_access/convert_lhs_class.carbon | 4 +- .../convert_lhs_interface.carbon | 6 +- .../evaluate_type_before_dot.carbon | 4 +- .../fail_qualified_non_member.carbon | 2 +- ...acuous_access_with_instance_binding.carbon | 4 +- .../param_qualified_interface_member.carbon | 4 +- .../qualified_class_member.carbon | 2 +- .../qualified_constraint_member.carbon | 4 +- .../qualified_interface_member.carbon | 4 +- .../qualified_param_member.carbon | 4 +- .../name_lookup/class_fn_body_reorder.carbon | 6 +- .../return/convert_return_value.carbon | 2 +- .../testdata/while/convert_condition.carbon | 4 +- third_party/examples/re2/re2.carbon | 138 +- utils/highlightjs/highlightjs_carbon_lang.js | 12 +- utils/highlightjs/highlightjs_example.html | 12 +- 191 files changed, 810 insertions(+), 33121 deletions(-) delete mode 100644 explorer/fuzzing/fuzzer_corpus/07c99567d27dcd6d7046c7dd7c12f09c2ddf2c9e delete mode 100644 explorer/fuzzing/fuzzer_corpus/091bf8f8567d807470ee5ef92b2b8659a0dfdfc3 delete mode 100644 explorer/fuzzing/fuzzer_corpus/0c1ae47ddcb696f04e02513d439f4a54921f08f3 delete mode 100644 explorer/fuzzing/fuzzer_corpus/10262aa9c545ac25ae1cd7ccd0cdd7ad758ad1d8 delete mode 100644 explorer/fuzzing/fuzzer_corpus/11d859d1c6b9ea0262e5fab224758bd6c34bed14 delete mode 100644 explorer/fuzzing/fuzzer_corpus/1691a7876803b03fa4e932b9e4b3cd370910b27c delete mode 100644 explorer/fuzzing/fuzzer_corpus/1b50f0f95f834081ac26a707b5ed161079fac7a9 delete mode 100644 explorer/fuzzing/fuzzer_corpus/26dc885153b426df9c1695ccd09a152eb39d744e delete mode 100644 explorer/fuzzing/fuzzer_corpus/281e1ca9619c28362d8674aceda9fff50b3892fb delete mode 100644 explorer/fuzzing/fuzzer_corpus/2b19e350556fbbc1d4821da650b3cf0d17148ae9 delete mode 100644 explorer/fuzzing/fuzzer_corpus/2b3791b3cd55ea889bb2ab7c54571506788e1ca9 delete mode 100644 explorer/fuzzing/fuzzer_corpus/304589d53b5ac70ae5b20bfb211e9ef2ef89c303 delete mode 100644 explorer/fuzzing/fuzzer_corpus/3090c90b834514f4dd338c2a22b63c25beb347c5 delete mode 100644 explorer/fuzzing/fuzzer_corpus/309601c5d0e404307e368b2582e13e55f6d51b1d delete mode 100644 explorer/fuzzing/fuzzer_corpus/35de79f70854c62b8f4b02abb8877d7277f2e961 delete mode 100644 explorer/fuzzing/fuzzer_corpus/3bc84abaa7693f3ca0f0681f6f1097e1766d9d89 delete mode 100644 explorer/fuzzing/fuzzer_corpus/3ed8ca560ef34c454714552d051ec8d184dda8c3 delete mode 100644 explorer/fuzzing/fuzzer_corpus/46e4b415ad8248b7aeeaad245c8f541253193949 delete mode 100644 explorer/fuzzing/fuzzer_corpus/47c8ce5c9e3190017234541803e0cb4df63a7813 delete mode 100644 explorer/fuzzing/fuzzer_corpus/48b1435c9df1e717046e6287b58fa56443ed1811 delete mode 100644 explorer/fuzzing/fuzzer_corpus/4e336ef2a037f5b85a70defee2016d0e82ebde61 delete mode 100644 explorer/fuzzing/fuzzer_corpus/503c9b96ee1cc78e58ec9b362db2bdac5e941119 delete mode 100644 explorer/fuzzing/fuzzer_corpus/54e9c97b2f7561cc205bc243927d1dbbbf753c16 delete mode 100644 explorer/fuzzing/fuzzer_corpus/5ad39cbb562bed711f6d6e8d44b631cb25881673 delete mode 100644 explorer/fuzzing/fuzzer_corpus/5b0eabed769a089e9906772fe0dfc78b111fee38 delete mode 100644 explorer/fuzzing/fuzzer_corpus/5f24e26f9bfacd281bc23e93f1cbdcb144743057 delete mode 100644 explorer/fuzzing/fuzzer_corpus/60d9b88eed255b0805f08ead84037690c554182b delete mode 100644 explorer/fuzzing/fuzzer_corpus/6318884693dd31430b4b46b1305dae63f281751e delete mode 100644 explorer/fuzzing/fuzzer_corpus/68a5800e6a2dbe2f732129fe874f20bbb42b90b5 delete mode 100644 explorer/fuzzing/fuzzer_corpus/6a879cdde713ac9009864ed5f9912616d314e017 delete mode 100644 explorer/fuzzing/fuzzer_corpus/6b308c0cf9835a750f16ee9aad989601b18c750b delete mode 100644 explorer/fuzzing/fuzzer_corpus/6c25c16bd50745570b78bee439871f5d6a0ca621 delete mode 100644 explorer/fuzzing/fuzzer_corpus/6cda920c7329398b3d5b3766b83c8deed3dc835c delete mode 100644 explorer/fuzzing/fuzzer_corpus/7157552a4bd3e30351e21e9a9139d8379ef34eb0 delete mode 100644 explorer/fuzzing/fuzzer_corpus/761eaa907a94fe001f6b5e31159f0b6c4ef171d8 delete mode 100644 explorer/fuzzing/fuzzer_corpus/781ecc36990e2394a0c6823855c583aae691bc78 delete mode 100644 explorer/fuzzing/fuzzer_corpus/8656cefeac8b03c9c7f2073d4811a04d69b83ec8 delete mode 100644 explorer/fuzzing/fuzzer_corpus/8c090ae94a3fdb5c70d49a69b7f6d0ac1cec7fdf delete mode 100644 explorer/fuzzing/fuzzer_corpus/910b0bf2a2d9eae7d81ff57e0f451282e869d1ed delete mode 100644 explorer/fuzzing/fuzzer_corpus/91e7c6b8d14f7d5a82076f29ac5cc135b27e1829 delete mode 100644 explorer/fuzzing/fuzzer_corpus/93520a24f7e183a277cd67f30907e0c979969e00 delete mode 100644 explorer/fuzzing/fuzzer_corpus/981655702b85acf10978cdb81df86b9399788092 delete mode 100644 explorer/fuzzing/fuzzer_corpus/9f1a867accead08d789b8f7d6b3b7303a643bbc2 delete mode 100644 explorer/fuzzing/fuzzer_corpus/ac929314f700519e9c008f6e2817910c067c949b delete mode 100644 explorer/fuzzing/fuzzer_corpus/b140b427aeef91089568f3b775bd4683bfad5c0e delete mode 100644 explorer/fuzzing/fuzzer_corpus/b1f2cfe33f8d50f38ce8addd62b76519bd589d9e delete mode 100644 explorer/fuzzing/fuzzer_corpus/b8e05ecd5da75a6af34295d2396d27fec1cfd4d5 delete mode 100644 explorer/fuzzing/fuzzer_corpus/be2a3f66b52634d15b9e34c0ed93ce8ffebcd527 delete mode 100644 explorer/fuzzing/fuzzer_corpus/bfa6ce9868e4fb4c6ddbc3f922c010261084f3a5 delete mode 100644 explorer/fuzzing/fuzzer_corpus/c2646dc4add2384ca4c733a9a706b218397cc1c8 delete mode 100644 explorer/fuzzing/fuzzer_corpus/c578992c249bcfb9ce98c775fee12bba7d7af36d delete mode 100644 explorer/fuzzing/fuzzer_corpus/c593c6692ed2ef06d7d2749add94d4ebd91dbba7 delete mode 100644 explorer/fuzzing/fuzzer_corpus/c769fdc8c81040b10176d937e9fea824e17b065f delete mode 100644 explorer/fuzzing/fuzzer_corpus/caf0048f803af5a515f0ebff6140d6e2ee52e8fb delete mode 100644 explorer/fuzzing/fuzzer_corpus/cd181298508a398cacb7dd4bd4eb75c14a8dd3e0 delete mode 100644 explorer/fuzzing/fuzzer_corpus/ce85fb106849dde89ccc11e6ff799faa8c74af07 delete mode 100644 explorer/fuzzing/fuzzer_corpus/ce8a72d8214224c0cf6cd1208452aa86ddb41a3c delete mode 100644 explorer/fuzzing/fuzzer_corpus/cea671bbabe96758d652ca6d207eb04a82e64923 delete mode 100644 explorer/fuzzing/fuzzer_corpus/ced66b30c1335523b9a066db3186ae300174d643 delete mode 100644 explorer/fuzzing/fuzzer_corpus/d1e5a00347368e94959ff07b93e4c6a0762091a8 delete mode 100644 explorer/fuzzing/fuzzer_corpus/dcd20be9b4193f2a2d428ca170d06e8f15066572 delete mode 100644 explorer/fuzzing/fuzzer_corpus/e18e54955a7d12d8676a628f6a8a2a700d09394d delete mode 100644 explorer/fuzzing/fuzzer_corpus/e29450683541d9d7ed77043b5bccc8e845fe909e delete mode 100644 explorer/fuzzing/fuzzer_corpus/e3b3b1f52b6d35189726bae3b49d358f1eda35d6 delete mode 100644 explorer/fuzzing/fuzzer_corpus/e6c980db2dc247d290d0bef72b045ddb3bc9e712 delete mode 100644 explorer/fuzzing/fuzzer_corpus/e9715683bb49b068d7e5848a6afa8ad6ad71bf07 delete mode 100644 explorer/fuzzing/fuzzer_corpus/eeffdec7cdffe7258413447330e745427673be5b delete mode 100644 explorer/fuzzing/fuzzer_corpus/ef9e4ddee87e9a1551d2cf0f56c2b2698d6000c0 delete mode 100644 explorer/fuzzing/fuzzer_corpus/fcbce51b08fb96910190bccab95620d12d64e5e2 delete mode 100644 explorer/fuzzing/fuzzer_corpus/fddfbdab89dbe1de7488636e4f664617ab2bbb68 delete mode 100644 explorer/fuzzing/fuzzer_corpus/ff3fae0020f618948885ab71526d70ec25893935 delete mode 100644 explorer/fuzzing/fuzzer_corpus/ff8a441cec416ebb3de16074ce2e864cab65cf16 delete mode 100644 explorer/testdata/addr/fail-method-self-type.carbon diff --git a/common/fuzzing/carbon.proto b/common/fuzzing/carbon.proto index 49b50d74a3518..0f48dc844966a 100644 --- a/common/fuzzing/carbon.proto +++ b/common/fuzzing/carbon.proto @@ -327,7 +327,7 @@ message ReturnTerm { message FunctionDeclaration { optional string name = 1; repeated GenericBinding deduced_parameters = 2; - optional Pattern self_pattern = 3; + optional Pattern me_pattern = 3; optional TuplePattern param_pattern = 4; optional ReturnTerm return_term = 5; optional BlockStatement body = 6; diff --git a/common/fuzzing/proto_to_carbon.cpp b/common/fuzzing/proto_to_carbon.cpp index bd937311f31fe..06d6630677c53 100644 --- a/common/fuzzing/proto_to_carbon.cpp +++ b/common/fuzzing/proto_to_carbon.cpp @@ -650,18 +650,17 @@ static auto DeclarationToCarbon(const Fuzzing::Declaration& declaration, out << "fn "; IdentifierToCarbon(function.name(), out); - if (!function.deduced_parameters().empty() || - function.has_self_pattern()) { + if (!function.deduced_parameters().empty() || function.has_me_pattern()) { out << "["; llvm::ListSeparator sep; for (const Fuzzing::GenericBinding& p : function.deduced_parameters()) { out << sep; GenericBindingToCarbon(p, out); } - if (function.has_self_pattern()) { + if (function.has_me_pattern()) { // This is a class method. out << sep; - PatternToCarbon(function.self_pattern(), out); + PatternToCarbon(function.me_pattern(), out); } out << "]"; } diff --git a/docs/design/README.md b/docs/design/README.md index dc79a38d83e5a..4a7a3d71d152f 100644 --- a/docs/design/README.md +++ b/docs/design/README.md @@ -1371,22 +1371,22 @@ Class type definitions can include methods: ```carbon class Point { // Method defined inline - fn Distance[self: Self](x2: i32, y2: i32) -> f32 { - var dx: i32 = x2 - self.x; - var dy: i32 = y2 - self.y; + fn Distance[me: Self](x2: i32, y2: i32) -> f32 { + var dx: i32 = x2 - me.x; + var dy: i32 = y2 - me.y; return Math.Sqrt(dx * dx + dy * dy); } // Mutating method declaration - fn Offset[addr self: Self*](dx: i32, dy: i32); + fn Offset[addr me: Self*](dx: i32, dy: i32); var x: i32; var y: i32; } // Out-of-line definition of method declared inline -fn Point.Offset[addr self: Self*](dx: i32, dy: i32) { - self->x += dx; - self->y += dy; +fn Point.Offset[addr me: Self*](dx: i32, dy: i32) { + me->x += dx; + me->y += dy; } var origin: Point = {.x = 0, .y = 0}; @@ -1398,16 +1398,16 @@ Assert(origin.Distance(3, 4) == 0.0); This defines a `Point` class type with two integer data members `x` and `y` and two methods `Distance` and `Offset`: -- Methods are defined as class functions with a `self` parameter inside square +- Methods are defined as class functions with a `me` parameter inside square brackets `[`...`]` before the regular explicit parameter list in parens `(`...`)`. - Methods are called using the member syntax, `origin.Distance(`...`)` and `origin.Offset(`...`)`. - `Distance` computes and returns the distance to another point, without - modifying the `Point`. This is signified using `[self: Self]` in the method + modifying the `Point`. This is signified using `[me: Self]` in the method declaration. - `origin.Offset(`...`)` does modify the value of `origin`. This is signified - using `[addr self: Self*]` in the method declaration. Since calling this + using `[addr me: Self*]` in the method declaration. Since calling this method requires taking the address of `origin`, it may only be called on [non-`const`](#const) [l-values](#value-categories-and-value-phases). - Methods may be declared lexically inline like `Distance`, or lexically out @@ -1553,12 +1553,12 @@ names resolvable by the compiler, and don't act like forward declarations. A destructor for a class is custom code executed when the lifetime of a value of that type ends. They are defined with the `destructor` keyword followed by -either `[self: Self]` or `[addr self: Self*]` (as is done with -[methods](#methods)) and the block of code in the class definition, as in: +either `[me: Self]` or `[addr me: Self*]` (as is done with [methods](#methods)) +and the block of code in the class definition, as in: ```carbon class MyClass { - destructor [self: Self] { ... } + destructor [me: Self] { ... } } ``` @@ -1566,8 +1566,8 @@ or: ```carbon class MyClass { - // Can modify `self` in the body. - destructor [addr self: Self*] { ... } + // Can modify `me` in the body. + destructor [addr me: Self*] { ... } } ``` @@ -1604,7 +1604,7 @@ For every type `MyClass`, there is the type `const MyClass` such that: - If member `x` of `MyClass` has type `T`, then member `x` of `const MyClass` has type `const T`. - The API of a `const MyClass` is a subset of `MyClass`, excluding all methods - taking `[addr self: Self*]`. + taking `[addr me: Self*]`. Note that `const` binds more tightly than postfix-`*` for forming a pointer type, so `const MyClass*` is equal to `(const MyClass)*`. @@ -2305,7 +2305,7 @@ capabilities that may be assumed of types that satisfy that constraint. interface Printable { // Inside an interface definition `Self` means // "the type implementing this interface". - fn Print[self: Self](); + fn Print[me: Self](); } ``` @@ -2328,8 +2328,8 @@ class Circle { var radius: f32; impl as Printable { - fn Print[self: Self]() { - Console.WriteLine("Circle with radius: {0}", self.radius); + fn Print[me: Self]() { + Console.WriteLine("Circle with radius: {0}", me.radius); } } } @@ -2422,9 +2422,9 @@ associated type to represent the type of elements stored in the stack. ``` interface StackInterface { let ElementType:! Movable; - fn Push[addr self: Self*](value: ElementType); - fn Pop[addr self: Self*]() -> ElementType; - fn IsEmpty[addr self: Self*]() -> bool; + fn Push[addr me: Self*](value: ElementType); + fn Pop[addr me: Self*]() -> ElementType; + fn IsEmpty[addr me: Self*]() -> bool; } ``` @@ -2434,14 +2434,14 @@ values for the `ElementType` member of the interface using a `where` clause: ```carbon class IntStack { impl as StackInterface where .ElementType == i32 { - fn Push[addr self: Self*](value: i32); + fn Push[addr me: Self*](value: i32); // ... } } class FruitStack { impl as StackInterface where .ElementType == Fruit { - fn Push[addr self: Self*](value: Fruit); + fn Push[addr me: Self*](value: Fruit); // ... } } @@ -2469,8 +2469,8 @@ type `T`: ```carbon class Stack(T:! Type) { - fn Push[addr self: Self*](value: T); - fn Pop[addr self: Self*]() -> T; + fn Push[addr me: Self*](value: T); + fn Pop[addr me: Self*]() -> T; var storage: Array(T); } @@ -2671,7 +2671,7 @@ types in the `impl` declaration, as in: ```carbon external impl like T as AddWith(like U) where .Result == V { // `Self` is `T` here - fn Op[self: Self](other: U) -> V { ... } + fn Op[me: Self](other: U) -> V { ... } } ``` @@ -2680,7 +2680,7 @@ implementing the `Add` interface: ```carbon external impl T as Add { - fn Op[self: Self](other: Self) -> Self { ... } + fn Op[me: Self](other: Self) -> Self { ... } } ``` diff --git a/docs/design/classes.md b/docs/design/classes.md index 4496672ab618a..79484cc710f7d 100644 --- a/docs/design/classes.md +++ b/docs/design/classes.md @@ -865,25 +865,25 @@ var p2: Point = p1.CreateCentered(); [Method]() declarations are distinguished from [class function](#class-functions) -declarations by having a `self` parameter in square brackets `[`...`]` before -the explicit parameter list in parens `(`...`)`. There is no implicit member -access in methods, so inside the method body members are accessed through the -`self` parameter. Methods may be written lexically inline or after the class +declarations by having a `me` parameter in square brackets `[`...`]` before the +explicit parameter list in parens `(`...`)`. There is no implicit member access +in methods, so inside the method body members are accessed through the `me` +parameter. Methods may be written lexically inline or after the class declaration. ```carbon class Circle { - fn Diameter[self: Self]() -> f32 { - return self.radius * 2; + fn Diameter[me: Self]() -> f32 { + return me.radius * 2; } - fn Expand[addr self: Self*](distance: f32); + fn Expand[addr me: Self*](distance: f32); var center: Point; var radius: f32; } -fn Circle.Expand[addr self: Self*](distance: f32) { - self->radius += distance; +fn Circle.Expand[addr me: Self*](distance: f32) { + me->radius += distance; } var c: Circle = {.center = Point.Origin(), .radius = 1.5 }; @@ -895,10 +895,10 @@ Assert(Math.Abs(c.Diameter() - 4.0) < 0.001); - Methods are called using the dot `.` member syntax, `c.Diameter()` and `c.Expand(`...`)`. - `Diameter` computes and returns the diameter of the circle without modifying - the `Circle` instance. This is signified using `[self: Self]` in the method + the `Circle` instance. This is signified using `[me: Self]` in the method declaration. - `c.Expand(`...`)` does modify the value of `c`. This is signified using - `[addr self: Self*]` in the method declaration. + `[addr me: Self*]` in the method declaration. The pattern '`addr` _patt_' means "first take the address of the argument, which must be an @@ -907,8 +907,8 @@ then match pattern _patt_ against it". If the method declaration also includes [deduced generic parameters](/docs/design/generics/overview.md#deduced-parameters), -the `self` parameter must be in the same list in square brackets `[`...`]`. The -`self` parameter may appear in any position in that list, as long as it appears +the `me` parameter must be in the same list in square brackets `[`...`]`. The +`me` parameter may appear in any position in that list, as long as it appears after any names needed to describe its type. #### Name lookup in member function definitions @@ -916,17 +916,17 @@ after any names needed to describe its type. When defining a member function lexically inline, we delay type checking of the function body until the definition of the current type is complete. This means that name lookup _for members of objects_ is also delayed. That means that you -can reference `self.F()` in a lexically inline method definition even before the +can reference `me.F()` in a lexically inline method definition even before the declaration of `F` in that class definition. However, other names still need to be declared before they are used. This includes unqualified names, names within namespaces, and names _for members of types_. ``` class Point { - fn Distance[self: Self]() -> f32 { + fn Distance[me: Self]() -> f32 { // ✅ Allowed: `x` and `y` are names for members of an object, - // and so lookup is delayed until `type_of(self) == Self` is complete. - return Math.Sqrt(self.x * self.x + self.y * self.y); + // and so lookup is delayed until `type_of(me) == Self` is complete. + return Math.Sqrt(me.x * me.x + me.y * me.y); } fn CreatePolarInvalid(r: f32, theta: f32) -> Point { @@ -955,7 +955,7 @@ class Point { fn CreateXAxis(x: f32) -> Point; - fn Angle[self: Self]() -> f32; + fn Angle[me: Self]() -> f32; var x: f32; var y: f32; @@ -967,10 +967,10 @@ fn Point.CreateXAxis(x: f32) -> Point; return Create(x, 0); } -fn Point.Angle[self: Self]() -> f32 { +fn Point.Angle[me: Self]() -> f32 { // ✅ Allowed: `Point` type is complete. // Function is checked immediately. - return Math.ATan2(self.y, self.x); + return Math.ATan2(me.y, me.x); } ``` @@ -1127,7 +1127,7 @@ declaration before `fn`. ``` base class MyBaseClass { - virtual fn Overridable[self: Self]() -> i32 { return 7; } + virtual fn Overridable[me: Self]() -> i32 { return 7; } } ``` @@ -1418,7 +1418,7 @@ the `destructor` keyword: ```carbon class MyClass { - destructor [self: Self] { ... } + destructor [me: Self] { ... } } ``` @@ -1426,13 +1426,13 @@ or: ```carbon class MyClass { - // Can modify `self` in the body. - destructor [addr self: Self*] { ... } + // Can modify `me` in the body. + destructor [addr me: Self*] { ... } } ``` If a class has no `destructor` declaration, it gets the default destructor, -which is equivalent to `destructor [self: Self] { }`. +which is equivalent to `destructor [me: Self] { }`. The destructor for a class is run before the destructors of its data members. The data members are destroyed in reverse order of declaration. Derived classes @@ -1450,9 +1450,9 @@ Destructors may be declared in class scope and then defined out-of-line: ```carbon class MyClass { - destructor [addr self: Self*]; + destructor [addr me: Self*]; } -destructor MyClass [addr self: Self*] { ... } +destructor MyClass [addr me: Self*] { ... } ``` It is illegal to delete an instance of a derived class through a pointer to one @@ -1464,11 +1464,11 @@ must be `impl`: ```carbon base class MyBaseClass { - virtual destructor [addr self: Self*] { ... } + virtual destructor [addr me: Self*] { ... } } class MyDerivedClass extends MyBaseClass { - impl destructor [addr self: Self*] { ... } + impl destructor [addr me: Self*] { ... } } ``` @@ -1518,8 +1518,8 @@ call the `UnsafeDelete` method instead. Note that you may not call ``` interface Allocator { // ... - fn Delete[T:! Deletable, addr self: Self*](p: T*); - fn UnsafeDelete[T:! Destructible, addr self: Self*](p: T*); + fn Delete[T:! Deletable, addr me: Self*](p: T*); + fn UnsafeDelete[T:! Destructible, addr me: Self*](p: T*); } ``` @@ -1566,7 +1566,7 @@ could potentially fail must be performed before the destructor is called. Unhandled failure during a destructor call will abort the program. **Future work:** Allow or require destructors to be declared as taking -`[var self: Self]`. +`[var me: Self]`. **Alternatives considered:** @@ -1630,7 +1630,7 @@ As in C++, `private` means only accessible to members of the class and any ```carbon class Point { - fn Distance[self: Self]() -> f32; + fn Distance[me: Self]() -> f32; // These are only accessible to members of `Point`. private var x: f32; private var y: f32; @@ -1668,15 +1668,15 @@ derived classes, and any [friends](#friends). ``` base class MyBaseClass { protected fn HelperClassFunction(x: i32) -> i32; - protected fn HelperMethod[self: Self](x: i32) -> i32; + protected fn HelperMethod[me: Self](x: i32) -> i32; protected var data: i32; } class MyDerivedClass extends MyBaseClass { - fn UsesProtected[addr self: Self*]() { + fn UsesProtected[addr me: Self*]() { // Can access protected members in derived class var x: i32 = HelperClassFunction(3); - self->data = self->HelperMethod(x); + me->data = me->HelperMethod(x); } } ``` diff --git a/docs/design/expressions/README.md b/docs/design/expressions/README.md index cae8c4eb058e6..3603f2dfc493f 100644 --- a/docs/design/expressions/README.md +++ b/docs/design/expressions/README.md @@ -232,9 +232,9 @@ with parentheses around the member name: - _expression_ `.` `(` _expression_ `)` ``` -interface I { fn F[self: Self](); } +interface I { fn F[me: Self](); } class X {} -external impl X as I { fn F[self: Self]() {} } +external impl X as I { fn F[me: Self]() {} } // `x.I.F()` would mean `(x.I).F()`. fn Q(x: X) { x.(I.F)(); } diff --git a/docs/design/expressions/arithmetic.md b/docs/design/expressions/arithmetic.md index ea05a91859696..6b3d2fcb395e5 100644 --- a/docs/design/expressions/arithmetic.md +++ b/docs/design/expressions/arithmetic.md @@ -194,7 +194,7 @@ following family of interfaces: // Unary `-`. interface Negate { let Result:! Type = Self; - fn Op[self: Self]() -> Result; + fn Op[me: Self]() -> Result; } ``` @@ -202,7 +202,7 @@ interface Negate { // Binary `+`. interface AddWith(U:! Type) { let Result:! Type = Self; - fn Op[self: Self](other: U) -> Result; + fn Op[me: Self](other: U) -> Result; } constraint Add { extends AddWith(Self) where .Result = Self; @@ -213,7 +213,7 @@ constraint Add { // Binary `-`. interface SubWith(U:! Type) { let Result:! Type = Self; - fn Op[self: Self](other: U) -> Result; + fn Op[me: Self](other: U) -> Result; } constraint Sub { extends SubWith(Self) where .Result = Self; @@ -224,7 +224,7 @@ constraint Sub { // Binary `*`. interface MulWith(U:! Type) { let Result:! Type = Self; - fn Op[self: Self](other: U) -> Result; + fn Op[me: Self](other: U) -> Result; } constraint Mul { extends MulWith(Self) where .Result = Self; @@ -235,7 +235,7 @@ constraint Mul { // Binary `/`. interface DivWith(U:! Type) { let Result:! Type = Self; - fn Op[self: Self](other: U) -> Result; + fn Op[me: Self](other: U) -> Result; } constraint Div { extends DivWith(Self) where .Result = Self; @@ -246,7 +246,7 @@ constraint Div { // Binary `%`. interface ModWith(U:! Type) { let Result:! Type = Self; - fn Op[self: Self](other: U) -> Result; + fn Op[me: Self](other: U) -> Result; } constraint Mod { extends ModWith(Self) where .Result = Self; diff --git a/docs/design/expressions/as_expressions.md b/docs/design/expressions/as_expressions.md index 83cefe77a5814..fb6ffc301f7ef 100644 --- a/docs/design/expressions/as_expressions.md +++ b/docs/design/expressions/as_expressions.md @@ -165,7 +165,7 @@ Explicit casts can be defined for user-defined types such as ``` interface As(Dest:! Type) { - fn Convert[self: Self]() -> Dest; + fn Convert[me: Self]() -> Dest; } ``` diff --git a/docs/design/expressions/bitwise.md b/docs/design/expressions/bitwise.md index 849cdff523139..2300cc557fb35 100644 --- a/docs/design/expressions/bitwise.md +++ b/docs/design/expressions/bitwise.md @@ -198,7 +198,7 @@ implementing the following family of interfaces: // Unary `^`. interface BitComplement { let Result:! Type = Self; - fn Op[self: Self]() -> Result; + fn Op[me: Self]() -> Result; } ``` @@ -206,7 +206,7 @@ interface BitComplement { // Binary `&`. interface BitAndWith(U:! Type) { let Result:! Type = Self; - fn Op[self: Self](other: U) -> Result; + fn Op[me: Self](other: U) -> Result; } constraint BitAnd { extends BitAndWith(Self) where .Result = Self; @@ -217,7 +217,7 @@ constraint BitAnd { // Binary `|`. interface BitOrWith(U:! Type) { let Result:! Type = Self; - fn Op[self: Self](other: U) -> Result; + fn Op[me: Self](other: U) -> Result; } constraint BitOr { extends BitOrWith(Self) where .Result = Self; @@ -228,7 +228,7 @@ constraint BitOr { // Binary `^`. interface BitXorWith(U:! Type) { let Result:! Type = Self; - fn Op[self: Self](other: U) -> Result; + fn Op[me: Self](other: U) -> Result; } constraint BitXor { extends BitXorWith(Self) where .Result = Self; @@ -239,7 +239,7 @@ constraint BitXor { // Binary `<<`. interface LeftShiftWith(U:! Type) { let Result:! Type = Self; - fn Op[self: Self](other: U) -> Result; + fn Op[me: Self](other: U) -> Result; } constraint LeftShift { extends LeftShiftWith(Self) where .Result = Self; @@ -250,7 +250,7 @@ constraint LeftShift { // Binary `>>`. interface RightShiftWith(U:! Type) { let Result:! Type = Self; - fn Op[self: Self](other: U) -> Result; + fn Op[me: Self](other: U) -> Result; } constraint RightShift { extends RightShiftWith(Self) where .Result = Self; diff --git a/docs/design/expressions/comparison_operators.md b/docs/design/expressions/comparison_operators.md index 42c2ee571e9ae..4836922bef1b0 100644 --- a/docs/design/expressions/comparison_operators.md +++ b/docs/design/expressions/comparison_operators.md @@ -254,9 +254,9 @@ operators for a given pair of types: ``` interface EqWith(U:! Type) { - fn Equal[self: Self](u: U) -> bool; - default fn NotEqual[self: Self](u: U) -> bool { - return not (self == u); + fn Equal[me: Self](u: U) -> bool; + default fn NotEqual[me: Self](u: U) -> bool { + return not (me == u); } } constraint Eq { @@ -273,11 +273,11 @@ Given `x: T` and `y: U`: class Path { private var drive: String; private var path: String; - private fn CanonicalPath[self: Self]() -> String; + private fn CanonicalPath[me: Self]() -> String; external impl as Eq { - fn Equal[self: Self](other: Self) -> bool { - return (self.drive, self.CanonicalPath()) == + fn Equal[me: Self](other: Self) -> bool { + return (me.drive, me.CanonicalPath()) == (other.drive, other.CanonicalPath()); } } @@ -293,12 +293,12 @@ can be used: ``` class MyInt { var value: i32; - fn Value[self: Self]() -> i32 { return self.value; } + fn Value[me: Self]() -> i32 { return me.value; } } external impl i32 as ImplicitAs(MyInt); external impl like MyInt as EqWith(like MyInt) { - fn Equal[self: Self](other: Self) -> bool { - return self.Value() == other.Value(); + fn Equal[me: Self](other: Self) -> bool { + return me.Value() == other.Value(); } } fn CompareBothWays(a: MyInt, b: i32, c: MyInt) -> bool { @@ -316,17 +316,17 @@ operations should have no observable side-effects. ``` external impl like MyFloat as EqWith(like MyFloat) { - fn Equal[self: MyFloat](other: MyFloat) -> bool { - if (self.IsNaN() or other.IsNaN()) { + fn Equal[me: MyFloat](other: MyFloat) -> bool { + if (me.IsNaN() or other.IsNaN()) { return false; } - return self.Representation() == other.Representation(); + return me.Representation() == other.Representation(); } - fn NotEqual[self: MyFloat](other: MyFloat) -> bool { - if (self.IsNaN() or other.IsNaN()) { + fn NotEqual[me: MyFloat](other: MyFloat) -> bool { + if (me.IsNaN() or other.IsNaN()) { return false; } - return self.Representation() != other.Representation(); + return me.Representation() != other.Representation(); } } ``` @@ -354,19 +354,19 @@ choice Ordering { Incomparable } interface OrderedWith(U:! Type) { - fn Compare[self: Self](u: U) -> Ordering; - default fn Less[self: Self](u: U) -> bool { - return self.Compare(u) == Ordering.Less; + fn Compare[me: Self](u: U) -> Ordering; + default fn Less[me: Self](u: U) -> bool { + return me.Compare(u) == Ordering.Less; } - default fn LessOrEquivalent[self: Self](u: U) -> bool { - let c: Ordering = self.Compare(u); + default fn LessOrEquivalent[me: Self](u: U) -> bool { + let c: Ordering = me.Compare(u); return c == Ordering.Less or c == Ordering.Equivalent; } - default fn Greater[self: Self](u: U) -> bool { - return self.Compare(u) == Ordering.Greater; + default fn Greater[me: Self](u: U) -> bool { + return me.Compare(u) == Ordering.Greater; } - default fn GreaterOrEquivalent[self: Self](u: U) -> bool { - let c: Ordering = self.Compare(u); + default fn GreaterOrEquivalent[me: Self](u: U) -> bool { + let c: Ordering = me.Compare(u); return c == Ordering.Greater or c == Ordering.Equivalent; } } @@ -395,12 +395,12 @@ class MyWidget { var width: i32; var height: i32; - fn Size[self: Self]() -> i32 { return self.width * self.height; } + fn Size[me: Self]() -> i32 { return me.width * me.height; } // Widgets are normally ordered by size. external impl as Ordered { - fn Compare[self: Self](other: Self) -> Ordering { - return self.Size().(Ordered.Compare)(other.Size()); + fn Compare[me: Self](other: Self) -> Ordering { + return me.Size().(Ordered.Compare)(other.Size()); } } } @@ -420,8 +420,8 @@ fn ReverseOrdering(o: Ordering) -> Ordering { } external impl like MyInt as OrderedWith(like MyFloat); external impl like MyFloat as OrderedWith(like MyInt) { - fn Compare[self: Self](other: Self) -> Ordering { - return Reverse(other.(OrderedWith(Self).Compare)(self)); + fn Compare[me: Self](other: Self) -> Ordering { + return Reverse(other.(OrderedWith(Self).Compare)(me)); } } ``` diff --git a/docs/design/expressions/implicit_conversions.md b/docs/design/expressions/implicit_conversions.md index 7edd61415e649..dd7b464ef2d83 100644 --- a/docs/design/expressions/implicit_conversions.md +++ b/docs/design/expressions/implicit_conversions.md @@ -210,7 +210,7 @@ extends interface ImplicitAs(Dest:! Type) { extends As(Dest); // Inherited from As(Dest): - // fn Convert[self: Self]() -> Dest; + // fn Convert[me: Self]() -> Dest; } ``` diff --git a/docs/design/expressions/member_access.md b/docs/design/expressions/member_access.md index a5a71b7d02d91..656800186180d 100644 --- a/docs/design/expressions/member_access.md +++ b/docs/design/expressions/member_access.md @@ -55,7 +55,7 @@ For example: ```carbon package Widgets api; interface Widget { - fn Grow[addr self: Self*](factor: f64); + fn Grow[addr me: Self*](factor: f64); } class Cog { var size: i32; @@ -163,7 +163,7 @@ For example: ``` interface Printable { - fn Print[self: Self](); + fn Print[me: Self](); } external impl i32 as Printable; class Point { @@ -238,11 +238,11 @@ actual value of a generic parameter never affects the result of member resolution. ```carbon -class Cowboy { fn Draw[self: Self](); } +class Cowboy { fn Draw[me: Self](); } interface Renderable { - fn Draw[self: Self](); + fn Draw[me: Self](); } -external impl Cowboy as Renderable { fn Draw[self: Self](); } +external impl Cowboy as Renderable { fn Draw[me: Self](); } fn DrawDirect(c: Cowboy) { c.Draw(); } fn DrawGeneric[T:! Renderable](c: T) { c.Draw(); } fn DrawTemplate[template T:! Renderable](c: T) { c.Draw(); } @@ -258,13 +258,13 @@ fn Draw(c: Cowboy) { class RoundWidget { external impl as Renderable { - fn Draw[self: Self](); + fn Draw[me: Self](); } alias Draw = Renderable.Draw; } class SquareWidget { - fn Draw[self: Self]() {} + fn Draw[me: Self]() {} external impl as Renderable { alias Draw = Self.Draw; } @@ -303,7 +303,7 @@ expression. ```carbon interface Addable { // #1 - fn Add[self: Self](other: Self) -> Self; + fn Add[me: Self](other: Self) -> Self; // #2 default fn Sum[Seq:! Iterable where .ValueType = Self](seq: Seq) -> Self { // ... @@ -313,7 +313,7 @@ interface Addable { class Integer { impl as Addable { // #3 - fn Add[self: Self](other: Self) -> Self; + fn Add[me: Self](other: Self) -> Self; // #4, generated from default implementation for #2. // fn Sum[...](...); } @@ -368,13 +368,13 @@ the argument for the template parameter is known. ```carbon interface I { // #1 - default fn F[self: Self]() {} + default fn F[me: Self]() {} let N:! i32; } class C { impl as I where .N = 5 { // #2 - fn F[self: C]() {} + fn F[me: C]() {} } } @@ -413,13 +413,13 @@ naming the interface member as a member of the class. ```carbon interface Renderable { // #1 - fn Draw[self: Self](); + fn Draw[me: Self](); } class RoundWidget { external impl as Renderable { // #2 - fn Draw[self: Self](); + fn Draw[me: Self](); } // `Draw` names the member of the `Renderable` interface. alias Draw = Renderable.Draw; @@ -427,7 +427,7 @@ class RoundWidget { class SquareWidget { // #3 - fn Draw[self: Self]() {} + fn Draw[me: Self]() {} external impl as Renderable { alias Draw = Self.Draw; } @@ -450,14 +450,14 @@ fn DrawWidget(r: RoundWidget, s: SquareWidget) { // ❌ Error: In the inner member access, the name `Draw` resolves to the // member `Draw` of `SquareWidget`, #3. // The outer member access fails because we can't call - // #3, `Draw[self: SquareWidget]()`, on a `RoundWidget` object `r`. + // #3, `Draw[me: SquareWidget]()`, on a `RoundWidget` object `r`. r.(SquareWidget.Draw)(); // ❌ Error: In the inner member access, the name `Draw` resolves to the // member `Draw` of `Renderable`, #1, which `impl` lookup replaces with // the member `Draw` of `impl RoundWidget as Renderable`, #2. // The outer member access fails because we can't call - // #2, `Draw[self: RoundWidget]()`, on a `SquareWidget` object `s`. + // #2, `Draw[me: RoundWidget]()`, on a `SquareWidget` object `s`. s.(RoundWidget.Draw)(); } @@ -511,19 +511,19 @@ value other than a type, then _instance binding_ is performed, as follows: - For a method, the result is a _bound method_, which is a value `F` such that a function call `F(args)` behaves the same as a call to `M(args)` with the - `self` parameter initialized by a corresponding recipient argument: + `me` parameter initialized by a corresponding recipient argument: - - If the method declares its `self` parameter with `addr`, the recipient + - If the method declares its `me` parameter with `addr`, the recipient argument is `&V`. - Otherwise, the recipient argument is `V`. ```carbon class Blob { - fn Mutate[addr self: Self*](n: i32); + fn Mutate[addr me: Self*](n: i32); } fn F(p: Blob*) { // ✅ OK, forms bound method `((*p).M)` and calls it. - // This calls `Blob.Mutate` with `self` initialized by `&(*p)` + // This calls `Blob.Mutate` with `me` initialized by `&(*p)` // and `n` initialized by `5`. (*p).Mutate(5); @@ -580,10 +580,10 @@ always used for lookup. ``` interface Printable { - fn Print[self: Self](); + fn Print[me: Self](); } external impl i32 as Printable { - fn Print[self: Self](); + fn Print[me: Self](); } fn MemberAccess(n: i32) { // ✅ OK: `Printable.Print` is the interface member. diff --git a/docs/design/generics/appendix-coherence.md b/docs/design/generics/appendix-coherence.md index 6ccd10b870679..475a794de867f 100644 --- a/docs/design/generics/appendix-coherence.md +++ b/docs/design/generics/appendix-coherence.md @@ -78,7 +78,7 @@ this: package SongHashArtistAndTitle; import SongLib; impl SongLib.Song as Hashable { - fn Hash[self: Self]() -> u64 { ... } + fn Hash[me: Self]() -> u64 { ... } } ``` @@ -105,7 +105,7 @@ this: package SongHashAppleMusicURL; import SongLib; impl SongLib.Song as Hashable { - fn Hash[self: Self]() -> u64 { ... } + fn Hash[me: Self]() -> u64 { ... } } ``` diff --git a/docs/design/generics/details.md b/docs/design/generics/details.md index 62b92c3dce33e..44f2a57eb9322 100644 --- a/docs/design/generics/details.md +++ b/docs/design/generics/details.md @@ -224,8 +224,8 @@ have two methods: ``` interface Vector { // Here `Self` means "the type implementing this interface". - fn Add[self: Self](b: Self) -> Self; - fn Scale[self: Self](v: f64) -> Self; + fn Add[me: Self](b: Self) -> Self; + fn Scale[me: Self](v: f64) -> Self; } ``` @@ -258,10 +258,10 @@ class Point { var y: f64; impl as Vector { // In this scope, "Self" is an alias for "Point". - fn Add[self: Self](b: Self) -> Self { + fn Add[me: Self](b: Self) -> Self { return {.x = a.x + b.x, .y = a.y + b.y}; } - fn Scale[self: Self](v: f64) -> Self { + fn Scale[me: Self](v: f64) -> Self { return {.x = a.x * v, .y = a.y * v}; } } @@ -302,11 +302,11 @@ class Point { var x: f64; var y: f64; impl as Vector { - fn Add[self: Self](b: Self) -> Self { ... } - fn Scale[self: Self](v: f64) -> Self { ... } + fn Add[me: Self](b: Self) -> Self { ... } + fn Scale[me: Self](v: f64) -> Self { ... } } impl as Drawable { - fn Draw[self: Self]() { ... } + fn Draw[me: Self]() { ... } } } ``` @@ -319,13 +319,13 @@ below). ``` class GameBoard { impl as Drawable { - fn Draw[self: Self]() { ... } + fn Draw[me: Self]() { ... } } impl as EndOfGame { // ❌ Error: `GameBoard` has two methods named // `Draw` with the same signature. - fn Draw[self: Self]() { ... } - fn Winner[self: Self](player: i32) { ... } + fn Draw[me: Self]() { ... } + fn Winner[me: Self](player: i32) { ... } } } ``` @@ -339,14 +339,14 @@ experience. class Player { var name: String; impl as Icon { - fn Name[self: Self]() -> String { return self.name; } + fn Name[me: Self]() -> String { return me.name; } // ... } impl as GameUnit { // Possible syntax options for defining // `GameUnit.Name` as the same as `Icon.Name`: alias Name = Icon.Name; - fn Name[self: Self]() -> String = Icon.Name; + fn Name[me: Self]() -> String = Icon.Name; // ... } } @@ -365,10 +365,10 @@ class Point2 { external impl as Vector { // In this scope, `Self` is an alias for `Point2`. - fn Add[self: Self](b: Self) -> Self { + fn Add[me: Self](b: Self) -> Self { return {.x = a.x + b.x, .y = a.y + b.y}; } - fn Scale[self: Self](v: f64) -> Self { + fn Scale[me: Self](v: f64) -> Self { return {.x = a.x * v, .y = a.y * v}; } } @@ -390,10 +390,10 @@ class Point3 { external impl Point3 as Vector { // In this scope, `Self` is an alias for `Point3`. - fn Add[self: Self](b: Self) -> Self { + fn Add[me: Self](b: Self) -> Self { return {.x = a.x + b.x, .y = a.y + b.y}; } - fn Scale[self: Self](v: f64) -> Self { + fn Scale[me: Self](v: f64) -> Self { return {.x = a.x * v, .y = a.y * v}; } } @@ -435,12 +435,12 @@ scope. class Point4a { var x: f64; var y: f64; - fn Add[self: Self](b: Self) -> Self { + fn Add[me: Self](b: Self) -> Self { return {.x = a.x + b.x, .y = a.y + b.y}; } external impl as Vector { alias Add = Point4a.Add; // Syntax TBD - fn Scale[self: Self](v: f64) -> Self { + fn Scale[me: Self](v: f64) -> Self { return {.x = a.x * v, .y = a.y * v}; } } @@ -452,10 +452,10 @@ class Point4b { var x: f64; var y: f64; external impl as Vector { - fn Add[self: Self](b: Self) -> Self { + fn Add[me: Self](b: Self) -> Self { return {.x = a.x + b.x, .y = a.y + b.y}; } - fn Scale[self: Self](v: f64) -> Self { + fn Scale[me: Self](v: f64) -> Self { return {.x = a.x * v, .y = a.y * v}; } } @@ -467,14 +467,14 @@ class Point4b { class Point4c { var x: f64; var y: f64; - fn Add[self: Self](b: Self) -> Self { + fn Add[me: Self](b: Self) -> Self { return {.x = a.x + b.x, .y = a.y + b.y}; } } external impl Point4c as Vector { alias Add = Point4c.Add; // Syntax TBD - fn Scale[self: Self](v: f64) -> Self { + fn Scale[me: Self](v: f64) -> Self { return {.x = a.x * v, .y = a.y * v}; } } @@ -540,7 +540,7 @@ package Plot; import Points; interface Drawable { - fn Draw[self: Self](); + fn Draw[me: Self](); } external impl Points.Point3 as Drawable { ... } @@ -691,7 +691,7 @@ implementing `Vector`, and a function that takes a `GeneralPoint` and calls ``` class GeneralPoint(C:! Numeric) { external impl as Vector { ... } - fn Get[self: Self](i: i32) -> C; + fn Get[me: Self](i: i32) -> C; } fn CallWithGeneralPoint[C:! Numeric](p: GeneralPoint(C)) -> C { @@ -965,8 +965,8 @@ requirements of `I2`. This means a value `x` of type `T` may be passed to functions requiring types to satisfy `I2`, as in this example: ``` -interface Printable { fn Print[self: Self](); } -interface Renderable { fn Draw[self: Self](); } +interface Printable { fn Print[me: Self](); } +interface Renderable { fn Draw[me: Self](); } constraint PrintAndRender { impl as Printable; @@ -998,11 +998,11 @@ the union of the names minus any conflicts. ``` interface Printable { - fn Print[self: Self](); + fn Print[me: Self](); } interface Renderable { - fn Center[self: Self]() -> (i32, i32); - fn Draw[self: Self](); + fn Center[me: Self]() -> (i32, i32); + fn Draw[me: Self](); } // `Printable & Renderable` is syntactic sugar for this type-of-type: @@ -1023,11 +1023,11 @@ fn PrintThenDraw[T:! Printable & Renderable](x: T) { class Sprite { // ... impl as Printable { - fn Print[self: Self]() { ... } + fn Print[me: Self]() { ... } } impl as Renderable { - fn Center[self: Self]() -> (i32, i32) { ... } - fn Draw[self: Self]() { ... } + fn Center[me: Self]() -> (i32, i32) { ... } + fn Draw[me: Self]() { ... } } } @@ -1040,12 +1040,12 @@ error to use. ``` interface Renderable { - fn Center[self: Self]() -> (i32, i32); - fn Draw[self: Self](); + fn Center[me: Self]() -> (i32, i32); + fn Draw[me: Self](); } interface EndOfGame { - fn Draw[self: Self](); - fn Winner[self: Self](player: i32); + fn Draw[me: Self](); + fn Winner[me: Self](player: i32); } // `Renderable & EndOfGame` is syntactic sugar for this type-of-type: constraint { @@ -1152,10 +1152,10 @@ requires all containers to also satisfy the requirements of semantics and syntax as we do for [named constraints](#named-constraints): ``` -interface Equatable { fn Equals[self: Self](rhs: Self) -> bool; } +interface Equatable { fn Equals[me: Self](rhs: Self) -> bool; } interface Iterable { - fn Advance[addr self: Self*]() -> bool; + fn Advance[addr me: Self*]() -> bool; impl as Equatable; } @@ -1168,8 +1168,8 @@ def DoAdvanceAndEquals[T:! Iterable](x: T) { } class Iota { - impl as Iterable { fn Advance[self: Self]() { ... } } - impl as Equatable { fn Equals[self: Self](rhs: Self) -> bool { ... } } + impl as Iterable { fn Advance[me: Self]() { ... } } + impl as Equatable { fn Equals[me: Self](rhs: Self) -> bool { ... } } } var x: Iota; DoAdvanceAndEquals(x); @@ -1181,7 +1181,7 @@ declarations: ``` interface Hashable { - fn Hash[self: Self]() -> u64; + fn Hash[me: Self]() -> u64; impl as Equatable; alias Equals = Equatable.Equals; } @@ -1208,8 +1208,8 @@ as well. In the case of `Hashable` above, this includes all the members of ``` class Song { impl as Hashable { - fn Hash[self: Self]() -> u64 { ... } - fn Equals[self: Self](rhs: Self) -> bool { ... } + fn Hash[me: Self]() -> u64 { ... } + fn Equals[me: Self](rhs: Self) -> bool { ... } } } var y: Song; @@ -1228,17 +1228,17 @@ benefits: We expect this concept to be common enough to warrant dedicated syntax: ``` -interface Equatable { fn Equals[self: Self](rhs: Self) -> bool; } +interface Equatable { fn Equals[me: Self](rhs: Self) -> bool; } interface Hashable { extends Equatable; - fn Hash[self: Self]() -> u64; + fn Hash[me: Self]() -> u64; } // is equivalent to the definition of Hashable from before: // interface Hashable { // impl as Equatable; // alias Equals = Equatable.Equals; -// fn Hash[self: Self]() -> u64; +// fn Hash[me: Self]() -> u64; // } ``` @@ -1301,10 +1301,10 @@ The `extends` declaration makes sense with the same meaning inside a ``` interface Media { - fn Play[self: Self](); + fn Play[me: Self](); } interface Job { - fn Run[self: Self](); + fn Run[me: Self](); } constraint Combined { @@ -1333,8 +1333,8 @@ constraint: ``` class Song { impl as Combined { - fn Play[self: Self]() { ... } - fn Run[self: Self]() { ... } + fn Play[me: Self]() { ... } + fn Run[me: Self]() { ... } } } ``` @@ -1344,10 +1344,10 @@ This is equivalent to implementing the required interfaces directly: ``` class Song { impl as Media { - fn Play[self: Self]() { ... } + fn Play[me: Self]() { ... } } impl as Job { - fn Run[self: Self]() { ... } + fn Run[me: Self]() { ... } } } ``` @@ -1362,7 +1362,7 @@ Conversely, an `interface` can extend a `constraint`: interface MovieCodec { extends Combined; - fn Load[addr self: Self*](filename: String); + fn Load[addr me: Self*](filename: String); } ``` @@ -1376,7 +1376,7 @@ interface MovieCodec { impl as Job; alias Run = Job.Run; - fn Load[addr self: Self*](filename: String); + fn Load[addr me: Self*](filename: String); } ``` @@ -1387,19 +1387,19 @@ Consider this set of interfaces, simplified from ``` interface Graph { - fn Source[addr self: Self*](e: EdgeDescriptor) -> VertexDescriptor; - fn Target[addr self: Self*](e: EdgeDescriptor) -> VertexDescriptor; + fn Source[addr me: Self*](e: EdgeDescriptor) -> VertexDescriptor; + fn Target[addr me: Self*](e: EdgeDescriptor) -> VertexDescriptor; } interface IncidenceGraph { extends Graph; - fn OutEdges[addr self: Self*](u: VertexDescriptor) + fn OutEdges[addr me: Self*](u: VertexDescriptor) -> (EdgeIterator, EdgeIterator); } interface EdgeListGraph { extends Graph; - fn Edges[addr self: Self*]() -> (EdgeIterator, EdgeIterator); + fn Edges[addr me: Self*]() -> (EdgeIterator, EdgeIterator); } ``` @@ -1424,13 +1424,13 @@ though could be defined in the `impl` block of `IncidenceGraph`, ``` class MyEdgeListIncidenceGraph { impl as IncidenceGraph { - fn Source[self: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } - fn Target[self: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } - fn OutEdges[addr self: Self*](u: VertexDescriptor) + fn Source[me: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } + fn Target[me: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } + fn OutEdges[addr me: Self*](u: VertexDescriptor) -> (EdgeIterator, EdgeIterator) { ... } } impl as EdgeListGraph { - fn Edges[addr self: Self*]() -> (EdgeIterator, EdgeIterator) { ... } + fn Edges[addr me: Self*]() -> (EdgeIterator, EdgeIterator) { ... } } } ``` @@ -1441,13 +1441,13 @@ though could be defined in the `impl` block of `IncidenceGraph`, ``` class MyEdgeListIncidenceGraph { impl as IncidenceGraph { - fn Source[self: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } - fn OutEdges[addr self: Self*](u: VertexDescriptor) + fn Source[me: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } + fn OutEdges[addr me: Self*](u: VertexDescriptor) -> (EdgeIterator, EdgeIterator) { ... } } impl as EdgeListGraph { - fn Target[self: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } - fn Edges[addr self: Self*]() -> (EdgeIterator, EdgeIterator) { ... } + fn Target[me: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } + fn Edges[addr me: Self*]() -> (EdgeIterator, EdgeIterator) { ... } } } ``` @@ -1457,8 +1457,8 @@ though could be defined in the `impl` block of `IncidenceGraph`, ``` class MyEdgeListIncidenceGraph { impl as Graph { - fn Source[self: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } - fn Target[self: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } + fn Source[me: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } + fn Target[me: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } } impl as IncidenceGraph { ... } impl as EdgeListGraph { ... } @@ -1473,8 +1473,8 @@ though could be defined in the `impl` block of `IncidenceGraph`, impl as EdgeListGraph { ... } } external impl MyEdgeListIncidenceGraph as Graph { - fn Source[self: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } - fn Target[self: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } + fn Source[me: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } + fn Target[me: Self](e: EdgeDescriptor) -> VertexDescriptor { ... } } ``` @@ -1496,17 +1496,17 @@ the capabilities of the iterator being passed in: ``` interface ForwardIntIterator { - fn Advance[addr self: Self*](); - fn Get[self: Self]() -> i32; + fn Advance[addr me: Self*](); + fn Get[me: Self]() -> i32; } interface BidirectionalIntIterator { extends ForwardIntIterator; - fn Back[addr self: Self*](); + fn Back[addr me: Self*](); } interface RandomAccessIntIterator { extends BidirectionalIntIterator; - fn Skip[addr self: Self*](offset: i32); - fn Difference[self: Self](rhs: Self) -> i32; + fn Skip[addr me: Self*](offset: i32); + fn Difference[me: Self](rhs: Self) -> i32; } fn SearchInSortedList[IterT:! ForwardIntIterator] @@ -1537,21 +1537,21 @@ APIs, in particular with different interface implementations, by ``` interface Printable { - fn Print[self: Self](); + fn Print[me: Self](); } interface Comparable { - fn Less[self: Self](rhs: Self) -> bool; + fn Less[me: Self](rhs: Self) -> bool; } class Song { - impl as Printable { fn Print[self: Self]() { ... } } + impl as Printable { fn Print[me: Self]() { ... } } } adapter SongByTitle for Song { impl as Comparable { - fn Less[self: Self](rhs: Self) -> bool { ... } + fn Less[me: Self](rhs: Self) -> bool { ... } } } adapter FormattedSong for Song { - impl as Printable { fn Print[self: Self]() { ... } } + impl as Printable { fn Print[me: Self]() { ... } } } adapter FormattedSongByTitle for Song { impl as Printable = FormattedSong; @@ -1581,8 +1581,8 @@ type may be accessed either by a cast: ``` adapter SongByTitle for Song { impl as Comparable { - fn Less[self: Self](rhs: Self) -> bool { - return (self as Song).Title() < (rhs as Song).Title(); + fn Less[me: Self](rhs: Self) -> bool { + return (me as Song).Title() < (rhs as Song).Title(); } } } @@ -1593,8 +1593,8 @@ or using a qualified member access expression: ``` adapter SongByTitle for Song { impl as Comparable { - fn Less[self: Self](rhs: Self) -> bool { - return self.(Song.Title)() < rhs.(Song.Title)(); + fn Less[me: Self](rhs: Self) -> bool { + return me.(Song.Title)() < rhs.(Song.Title)(); } } } @@ -1620,7 +1620,7 @@ Consider a type with a generic type parameter, like a hash map: ``` interface Hashable { ... } class HashMap(KeyT:! Hashable, ValueT:! Type) { - fn Find[self: Self](key: KeyT) -> Optional(ValueT); + fn Find[me:Self](key: KeyT) -> Optional(ValueT); // ... } ``` @@ -1706,7 +1706,7 @@ individually or renamed using `alias` declarations. ``` adapter SongRenderToPrintDriver extends Song { // Add a new `Print()` member function. - fn Print[self: Self]() { ... } + fn Print[me: Self]() { ... } // Avoid name conflict with new `Print` function by making // the implementation of the `Printable` interface external. @@ -1772,7 +1772,7 @@ smaller: ``` interface Comparable { - fn Less[self: Self](rhs: Self) -> bool; + fn Less[me: Self](rhs: Self) -> bool; } ``` @@ -1781,19 +1781,19 @@ another interface `Difference`: ``` interface Difference { - fn Sub[self: Self](rhs: Self) -> i32; + fn Sub[me:Self](rhs: Self) -> i32; } adapter ComparableFromDifference(T:! Difference) for T { impl as Comparable { - fn Less[self: Self](rhs: Self) -> bool { - return (self as T).Sub(rhs) < 0; + fn Less[me: Self](rhs: Self) -> bool { + return (me as T).Sub(rhs) < 0; } } } class IntWrapper { var x: i32; impl as Difference { - fn Sub[self: Self](rhs: Self) -> i32 { + fn Sub[me: Self](rhs: Self) -> i32 { return left.x - right.x; } } @@ -1808,8 +1808,8 @@ use to the adapter instead: adapter ComparableFromDifferenceFn (T:! Type, Difference:! fnty(T, T)->i32) for T { impl as Comparable { - fn Less[self: Self](rhs: Self) -> bool { - return Difference(self, rhs) < 0; + fn Less[me: Self](rhs: Self) -> bool { + return Difference(me, rhs) < 0; } } } @@ -1830,14 +1830,14 @@ to say that type implements an interface as a private detail internal to the implementation of the type. In that case, instead of implementing the interface for the public type, the library can create a private adapter for that type and implement the interface on that instead. Any member of the class can cast its -`self` parameter to the adapter type when it wants to make use of the private +`me` parameter to the adapter type when it wants to make use of the private impl. ``` // Public, in API file class Complex64 { // ... - fn CloserToOrigin[self: Self](them: Self) -> bool; + fn CloserToOrigin[me: Self](them: Self) -> bool; } // Private @@ -1847,14 +1847,14 @@ adapter ByReal extends Complex64 { // but this comparison function is useful for some // method implementations. impl as Comparable { - fn Less[self: Self](that: Self) -> bool { - return self.Real() < that.Real(); + fn Less[me: Self](that: Self) -> bool { + return me.Real() < that.Real(); } } } -fn Complex64.CloserToOrigin[self: Self](them: Self) -> bool { - var me_mag: ByReal = self * self.Conj() as ByReal; +fn Complex64.CloserToOrigin[me: Self](them: Self) -> bool { + var me_mag: ByReal = me * me.Conj() as ByReal; var them_mag: ByReal = them * them.Conj() as ByReal; return me_mag.Less(them_mag); } @@ -1867,10 +1867,10 @@ that is [implemented externally](terminology.md#external-impl) for a type. ``` interface DrawingContext { - fn SetPen[self: Self](...); - fn SetFill[self: Self](...); - fn DrawRectangle[self: Self](...); - fn DrawLine[self: Self](...); + fn SetPen[me: Self](...); + fn SetFill[me: Self](...); + fn DrawRectangle[me: Self](...); + fn DrawLine[me: Self](...); ... } external impl Window as DrawingContext { ... } @@ -1920,10 +1920,10 @@ associated constant. interface NSpacePoint { let N:! i32; // The following require: 0 <= i < N. - fn Get[addr self: Self*](i: i32) -> f64; - fn Set[addr self: Self*](i: i32, value: f64); + fn Get[addr me: Self*](i: i32) -> f64; + fn Set[addr me: Self*](i: i32, value: f64); // Associated constants may be used in signatures: - fn SetAll[addr self: Self*](value: Array(f64, N)); + fn SetAll[addr me: Self*](value: Array(f64, N)); } ``` @@ -1934,17 +1934,17 @@ a [`where` clause](#where-constraints). For example, implementations of ``` class Point2D { impl as NSpacePoint where .N = 2 { - fn Get[addr self: Self*](i: i32) -> f64 { ... } - fn Set[addr self: Self*](i: i32, value: f64) { ... } - fn SetAll[addr self: Self*](value: Array(f64, 2)) { ... } + fn Get[addr me: Self*](i: i32) -> f64 { ... } + fn Set[addr me: Self*](i: i32, value: f64) { ... } + fn SetAll[addr me: Self*](value: Array(f64, 2)) { ... } } } class Point3D { impl as NSpacePoint where .N = 3 { - fn Get[addr self: Self*](i: i32) -> f64 { ... } - fn Set[addr self: Self*](i: i32, value: f64) { ... } - fn SetAll[addr self: Self*](value: Array(f64, 3)) { ... } + fn Get[addr me: Self*](i: i32) -> f64 { ... } + fn Set[addr me: Self*](i: i32, value: f64) { ... } + fn SetAll[addr me: Self*](value: Array(f64, 3)) { ... } } } ``` @@ -2036,9 +2036,9 @@ name. For example: ``` interface StackAssociatedType { let ElementType:! Type; - fn Push[addr self: Self*](value: ElementType); - fn Pop[addr self: Self*]() -> ElementType; - fn IsEmpty[addr self: Self*]() -> bool; + fn Push[addr me: Self*](value: ElementType); + fn Pop[addr me: Self*]() -> ElementType; + fn IsEmpty[addr me: Self*]() -> bool; } ``` @@ -2051,26 +2051,26 @@ implements `StackAssociatedType`: ``` class DynamicArray(T:! Type) { class IteratorType { ... } - fn Begin[addr self: Self*]() -> IteratorType; - fn End[addr self: Self*]() -> IteratorType; - fn Insert[addr self: Self*](pos: IteratorType, value: T); - fn Remove[addr self: Self*](pos: IteratorType); + fn Begin[addr me: Self*]() -> IteratorType; + fn End[addr me: Self*]() -> IteratorType; + fn Insert[addr me: Self*](pos: IteratorType, value: T); + fn Remove[addr me: Self*](pos: IteratorType); // Set the associated type `ElementType` to `T`. impl as StackAssociatedType where .ElementType = T { - fn Push[addr self: Self*](value: ElementType) { - self->Insert(self->End(), value); + fn Push[addr me: Self*](value: ElementType) { + me->Insert(me->End(), value); } - fn Pop[addr self: Self*]() -> ElementType { - var pos: IteratorType = self->End(); - Assert(pos != self->Begin()); + fn Pop[addr me: Self*]() -> ElementType { + var pos: IteratorType = me->End(); + Assert(pos != me->Begin()); --pos; returned var ret: ElementType = *pos; - self->Remove(pos); + me->Remove(pos); return var; } - fn IsEmpty[addr self: Self*]() -> bool { - return self->Begin() == self->End(); + fn IsEmpty[addr me: Self*]() -> bool { + return me->Begin() == me->End(); } } } @@ -2149,12 +2149,12 @@ witness table. ``` interface Iterator { - fn Advance[addr self: Self*](); + fn Advance[addr me: Self*](); } interface Container { let IteratorType:! Iterator; - fn Begin[addr self: Self*]() -> IteratorType; + fn Begin[addr me: Self*]() -> IteratorType; } ``` @@ -2192,9 +2192,9 @@ of the associated type declaration: ``` interface StackParameterized(ElementType:! Type) { - fn Push[addr self: Self*](value: ElementType); - fn Pop[addr self: Self*]() -> ElementType; - fn IsEmpty[addr self: Self*]() -> bool; + fn Push[addr me: Self*](value: ElementType); + fn Pop[addr me: Self*]() -> ElementType; + fn IsEmpty[addr me: Self*]() -> bool; } ``` @@ -2206,25 +2206,25 @@ class Produce { var fruit: DynamicArray(Fruit); var veggie: DynamicArray(Veggie); impl as StackParameterized(Fruit) { - fn Push[addr self: Self*](value: Fruit) { - self->fruit.Push(value); + fn Push[addr me: Self*](value: Fruit) { + me->fruit.Push(value); } - fn Pop[addr self: Self*]() -> Fruit { - return self->fruit.Pop(); + fn Pop[addr me: Self*]() -> Fruit { + return me->fruit.Pop(); } - fn IsEmpty[addr self: Self*]() -> bool { - return self->fruit.IsEmpty(); + fn IsEmpty[addr me: Self*]() -> bool { + return me->fruit.IsEmpty(); } } impl as StackParameterized(Veggie) { - fn Push[addr self: Self*](value: Veggie) { - self->veggie.Push(value); + fn Push[addr me: Self*](value: Veggie) { + me->veggie.Push(value); } - fn Pop[addr self: Self*]() -> Veggie { - return self->veggie.Pop(); + fn Pop[addr me: Self*]() -> Veggie { + return me->veggie.Pop(); } - fn IsEmpty[addr self: Self*]() -> bool { - return self->veggie.IsEmpty(); + fn IsEmpty[addr me: Self*]() -> bool { + return me->veggie.IsEmpty(); } } } @@ -2272,7 +2272,7 @@ be comparable with multiple other types, and in fact interfaces for ``` interface EquatableWith(T:! Type) { - fn Equals[self: Self](rhs: T) -> bool; + fn Equals[me: Self](rhs: T) -> bool; ... } class Complex { @@ -2300,8 +2300,8 @@ could be an interface parameter: ``` interface ReadTupleMember(index:! u32) { let T:! Type; - // Returns self[index] - fn Get[self: Self]() -> T; + // Returns me[index] + fn Get[me: Self]() -> T; } ``` @@ -2313,7 +2313,7 @@ parameters are required to always be different. For example: ``` interface Map(FromType:! Type, ToType:! Type) { - fn Map[addr self: Self*](needle: FromType) -> Optional(ToType); + fn Map[addr me: Self*](needle: FromType) -> Optional(ToType); } class Bijection(FromType:! Type, ToType:! Type) { impl as Map(FromType, ToType) { ... } @@ -2405,7 +2405,7 @@ fn F[V:! D where ...](v: V) { ... } // Constraints on a class parameter: class S(T:! B where ...) { // Constraints on a method: - fn G[self: Self, V:! D where ...](v: V); + fn G[me: Self, V:! D where ...](v: V); } // Constraints on an interface parameter: @@ -2413,7 +2413,7 @@ interface A(T:! B where ...) { // Constraints on an associated type: let U:! C where ...; // Constraints on an associated method: - fn G[self: Self, V:! D where ...](v: V); + fn G[me: Self, V:! D where ...](v: V); } ``` @@ -2740,7 +2740,7 @@ to encode the return type: interface HasAbs { extends Numeric; let MagnitudeType:! Numeric; - fn Abs[self: Self]() -> MagnitudeType; + fn Abs[me: Self]() -> MagnitudeType; } ``` @@ -2783,7 +2783,7 @@ interface Container { where .ElementType == ElementType and .SliceType == .Self; - fn GetSlice[addr self: Self*] + fn GetSlice[addr me: Self*] (start: IteratorType, end: IteratorType) -> SliceType; } ``` @@ -2840,7 +2840,7 @@ from an integer type like `i32`: ``` interface As(T:! Type) { - fn Convert[self: Self]() -> T; + fn Convert[me: Self]() -> T; } fn Double[T:! Mul where i32 is As(.Self)](x: T) -> T { @@ -2911,7 +2911,7 @@ limited to a single signature. Consider this interface declaration: ``` interface GraphNode { let Edge:! Type; - fn EdgesFrom[self: Self]() -> HashSet(Edge); + fn EdgesFrom[me: Self]() -> HashSet(Edge); } ``` @@ -3000,17 +3000,17 @@ Given this interface `Transitive` that has associated types that are constrained to all be equal, with interfaces `P`, `Q`, and `R`: ``` -interface P { fn InP[self: Self](); } -interface Q { fn InQ[self: Self](); } -interface R { fn InR[self: Self](); } +interface P { fn InP[me:Self](); } +interface Q { fn InQ[me:Self](); } +interface R { fn InR[me:Self](); } interface Transitive { let A:! P; let B:! Q where .Self == A; let C:! R where .Self == B; - fn GetA[self: Self]() -> A; - fn TakesC[self: Self](c: C); + fn GetA[me: Self]() -> A; + fn TakesC[me:Self](c: C); } ``` @@ -3075,9 +3075,9 @@ interface Commute { let X:! Commute; let Y:! Commute where .X == X.Y; - fn GetX[self: Self]() -> X; - fn GetY[self: Self]() -> Y; - fn TakesXXY[self: Self](xxy: X.X.Y); + fn GetX[me: Self]() -> X; + fn GetY[me: Self]() -> Y; + fn TakesXXY[me:Self](xxy: X.X.Y); } ``` @@ -3172,17 +3172,17 @@ link between associated types `A` and `C` that allows function `F` to type check. ``` -interface P { fn InP[self: Self](); } -interface Q { fn InQ[self: Self](); } -interface R { fn InR[self: Self](); } +interface P { fn InP[me:Self](); } +interface Q { fn InQ[me:Self](); } +interface R { fn InR[me:Self](); } interface Transitive { let A:! P; let B:! Q where .Self == A; let C:! R where .Self == B; - fn GetA[self: Self]() -> A; - fn TakesC[self: Self](c: C); + fn GetA[me: Self]() -> A; + fn TakesC[me:Self](c: C); // Without this `observe` declaration, the // calls in `F` below would not be allowed. @@ -3300,7 +3300,7 @@ the same interface for a type. ``` enum CompareResult { Less, Equal, Greater } interface Comparable { - fn Compare[self: Self](rhs: Self) -> CompareResult; + fn Compare[me: Self](rhs: Self) -> CompareResult; } fn CombinedLess[T:! Type](a: T, b: T, U:! CompatibleWith(T) & Comparable, @@ -3360,9 +3360,9 @@ adapter ThenCompare( CompareList:! List(CompatibleWith(T) & Comparable)) for T { impl as Comparable { - fn Compare[self: Self](rhs: Self) -> CompareResult { + fn Compare[me: Self](rhs: Self) -> CompareResult { for (let U:! auto in CompareList) { - var result: CompareResult = (self as U).Compare(rhs as U); + var result: CompareResult = (me as U).Compare(rhs as U); if (result != CompareResult.Equal) { return result; } @@ -3656,15 +3656,15 @@ To do this with an [`external impl`](#external-impl), specify a more-specific ``` interface Printable { - fn Print[self: Self](); + fn Print[me: Self](); } class Vector(T:! Type) { ... } // By saying "T:! Printable" instead of "T:! Type" here, // we constrain T to be Printable for this impl. external impl forall [T:! Printable] Vector(T) as Printable { - fn Print[self: Self]() { - for (let a: T in self) { + fn Print[me: Self]() { + for (let a: T in me) { // Can call `Print` on `a` since the constraint // on `T` ensures it implements `Printable`. a.Print(); @@ -3719,11 +3719,11 @@ member name, even if their conditions are mutually exclusive: ``` class X(T:! Type) { impl X(i32) as Foo { - fn F[self: Self](); + fn F[me: Self](); } impl X(i64) as Bar { // ❌ Illegal: name conflict between `Foo.F` and `Bar.F` - fn F[self: Self](n: i64); + fn F[me: Self](n: i64); } } ``` @@ -3734,11 +3734,11 @@ is no overlap in the conditions: ``` class X(T:! Type) { impl X(i32) as Foo { - fn F[self: Self](); + fn F[me: Self](); } impl X(i64) as Foo { // ✅ Allowed: `X(T).F` consistently means `X(T).(Foo.F)` - fn F[self: Self](); + fn F[me: Self](); } } ``` @@ -3763,7 +3763,7 @@ a vector type that only has a `Sort` method if its elements implement the ``` class Vector(T:! Type) { // `Vector(T)` has a `Sort()` method if `T` is `Comparable`. - fn Sort[C:! Comparable, addr self: Vector(C)*](); + fn Sort[C:! Comparable, addr me: Vector(C)*](); } ``` @@ -4142,20 +4142,20 @@ generic function call, such as using an operator: // Interface defining the behavior of the prefix-* operator interface Deref { let Result:! Type; - fn DoDeref[self: Self]() -> Result; + fn DoDeref[me: Self]() -> Result; } // Types implementing `Deref` class Ptr(T:! Type) { ... external impl as Deref where .Result = T { - fn DoDeref[self: Self]() -> Result { ... } + fn DoDeref[me: Self]() -> Result { ... } } } class Optional(T:! Type) { ... external impl as Deref where .Result = T { - fn DoDeref[self: Self]() -> Result { ... } + fn DoDeref[me: Self]() -> Result { ... } } } @@ -4185,14 +4185,14 @@ class Ptr(T:! Type) { ... // Note: added `final` final external impl as Deref where .Result = T { - fn DoDeref[self: Self]() -> Result { ... } + fn DoDeref[me: Self]() -> Result { ... } } } class Optional(T:! Type) { ... // Note: added `final` final external impl as Deref where .Result = T { - fn DoDeref[self: Self]() -> Result { ... } + fn DoDeref[me: Self]() -> Result { ... } } } @@ -4547,11 +4547,11 @@ private constraint NodeFor(E:! Edge); // Define interfaces using named constraints. interface Edge { let NodeType:! NodeFor(Self); - fn Head[self: Self]() -> NodeType; + fn Head[me: Self]() -> NodeType; } interface Node { let EdgeType:! EdgeFor(Self); - fn Edges[self: Self]() -> Vector(EdgeType); + fn Edges[me: Self]() -> Vector(EdgeType); } // Now that the interfaces are defined, can @@ -4626,11 +4626,11 @@ methods in the interface. ``` interface Vector { - fn Add[self: Self](b: Self) -> Self; - fn Scale[self: Self](v: f64) -> Self; + fn Add[me: Self](b: Self) -> Self; + fn Scale[me: Self](v: f64) -> Self; // Default definition of `Invert` calls `Scale`. - default fn Invert[self: Self]() -> Self { - return self.Scale(-1.0); + default fn Invert[me: Self]() -> Self { + return me.Scale(-1.0); } } ``` @@ -4640,14 +4640,14 @@ file as the interface definition: ``` interface Vector { - fn Add[self: Self](b: Self) -> Self; - fn Scale[self: Self](v: f64) -> Self; - default fn Invert[self: Self]() -> Self; + fn Add[me: Self](b: Self) -> Self; + fn Scale[me: Self](v: f64) -> Self; + default fn Invert[me: Self]() -> Self; } // `Vector` is considered complete at this point, // even though `Vector.Invert` is still incomplete. -fn Vector.Invert[self: Self]() -> Self { - return self.Scale(-1.0); +fn Vector.Invert[me: Self]() -> Self { + return me.Scale(-1.0); } ``` @@ -4667,12 +4667,12 @@ types, and interface parameters, using the `= ` syntax. ``` interface Add(Right:! Type = Self) { default let Result:! Type = Self; - fn DoAdd[self: Self](right: Right) -> Result; + fn DoAdd[me: Self](right: Right) -> Result; } impl String as Add() { // Right == Result == Self == String - fn DoAdd[self: Self](right: Self) -> Self; + fn DoAdd[me: Self](right: Self) -> Self; } ``` @@ -4705,12 +4705,12 @@ interface. ``` interface TotalOrder { - fn TotalLess[self: Self](right: Self) -> bool; + fn TotalLess[me: Self](right: Self) -> bool; // ❌ Illegal: May not provide definition // for required interface. impl as PartialOrder { - fn PartialLess[self: Self](right: Self) -> bool { - return self.TotalLess(right); + fn PartialLess[me: Self](right: Self) -> bool { + return me.TotalLess(right); } } } @@ -4721,13 +4721,13 @@ instead: ``` interface TotalOrder { - fn TotalLess[self: Self](right: Self) -> bool; + fn TotalLess[me: Self](right: Self) -> bool; impl as PartialOrder; } external impl forall [T:! TotalOrder] T as PartialOrder { - fn PartialLess[self: Self](right: Self) -> bool { - return self.TotalLess(right); + fn PartialLess[me: Self](right: Self) -> bool { + return me.TotalLess(right); } } ``` @@ -4750,18 +4750,18 @@ overridden in impls. ``` interface TotalOrder { - fn TotalLess[self: Self](right: Self) -> bool; - final fn TotalGreater[self: Self](right: Self) -> bool { - return right.TotalLess(self); + fn TotalLess[me: Self](right: Self) -> bool; + final fn TotalGreater[me: Self](right: Self) -> bool { + return right.TotalLess(me); } } class String { impl as TotalOrder { - fn TotalLess[self: Self](right: Self) -> bool { ... } + fn TotalLess[me: Self](right: Self) -> bool { ... } // ❌ Illegal: May not provide definition of final // method `TotalGreater`. - fn TotalGreater[self: Self](right: Self) -> bool { ... } + fn TotalGreater[me: Self](right: Self) -> bool { ... } } } @@ -4770,7 +4770,7 @@ interface Add(T:! Type = Self) { final let AddWith:! Type = T; // Has a *default* of `Self` let Result:! Type = Self; - fn DoAdd[self: Self](right: AddWith) -> Result; + fn DoAdd[me: Self](right: AddWith) -> Result; } ``` @@ -4778,13 +4778,13 @@ Final members may also be defined out-of-line: ``` interface TotalOrder { - fn TotalLess[self: Self](right: Self) -> bool; - final fn TotalGreater[self: Self](right: Self) -> bool; + fn TotalLess[me: Self](right: Self) -> bool; + final fn TotalGreater[me: Self](right: Self) -> bool; } // `TotalOrder` is considered complete at this point, even // though `TotalOrder.TotalGreater` is not yet defined. -fn TotalOrder.TotalGreater[self: Self](right: Self) -> bool { - return right.TotalLess(self); +fn TotalOrder.TotalGreater[me: Self](right: Self) -> bool { + return right.TotalLess(me); } ``` @@ -5041,7 +5041,7 @@ interface to overload the unary `-` operator: // Unary `-`. interface Negatable { let Result:! Type = Self; - fn Negate[self: Self]() -> Result; + fn Negate[me: Self]() -> Result; } ``` @@ -5063,7 +5063,7 @@ expression, implement the ``` interface As(Dest:! Type) { - fn Convert[self: Self]() -> Dest; + fn Convert[me: Self]() -> Dest; } ``` @@ -5079,7 +5079,7 @@ for a binary operator like `*`: // Binary `*`. interface MultipliableWith(U:! Type) { let Result:! Type = Self; - fn Multiply[self: Self](other: U) -> Result; + fn Multiply[me: Self](other: U) -> Result; } ``` @@ -5102,14 +5102,14 @@ second implementation from the first, as in: ``` interface ComparableWith(RHS:! Type) { - fn Compare[self: Self](right: RHS) -> CompareResult; + fn Compare[me: Self](right: RHS) -> CompareResult; } adapter ReverseComparison (T:! Type, U:! ComparableWith(RHS)) for T { impl as ComparableWith(U) { - fn Compare[self: Self](right: RHS) -> CompareResult { - return ReverseCompareResult(right.Compare(self)); + fn Compare[me: Self](right: RHS) -> CompareResult { + return ReverseCompareResult(right.Compare(me)); } } } @@ -5129,7 +5129,7 @@ an interface that the other implements: ``` interface IntLike { - fn AsInt[self: Self]() -> i64; + fn AsInt[me: Self]() -> i64; } class EvenInt { ... } @@ -5170,13 +5170,13 @@ multiplying by a value of type `f64`: ``` class Meters { - fn Scale[self: Self](s: f64) -> Self; + fn Scale[me: Self](s: f64) -> Self; } // "Implementation One" external impl Meters as MultipliableWith(f64) where .Result = Meters { - fn Multiply[self: Self](other: f64) -> Result { - return self.Scale(other); + fn Multiply[me: Self](other: f64) -> Result { + return me.Scale(other); } } ``` @@ -5204,10 +5204,10 @@ conversion. The implementation is for types that implement the // "Implementation Two" external impl forall [T:! ImplicitAs(f64)] Meters as MultipliableWith(T) where .Result = Meters { - fn Multiply[self: Self](other: T) -> Result { + fn Multiply[me: Self](other: T) -> Result { // Carbon will implicitly convert `other` from type // `T` to `f64` to perform this call. - return self.(Meters.(MultipliableWith(f64).Multiply))(other); + return me.(Meters.(MultipliableWith(f64).Multiply))(other); } } // ✅ Allowed: uses `Meters as MultipliableWith(T)` impl @@ -5228,8 +5228,8 @@ of a forward declaration or definition, in a place of a type. // compared to "implementation one" above. external impl Meters as MultipliableWith(like f64) where .Result = Meters { - fn Multiply[self: Self](other: f64) -> Result { - return self.Scale(other); + fn Multiply[me: Self](other: f64) -> Result { + return me.Scale(other); } } ``` @@ -5251,8 +5251,8 @@ In this example, there are two uses of `like`, producing three implementations ``` external impl like Meters as MultipliableWith(like f64) where .Result = Meters { - fn Multiply[self: Self](other: f64) -> Result { - return self.Scale(other); + fn Multiply[me: Self](other: f64) -> Result { + return me.Scale(other); } } ``` @@ -5262,10 +5262,10 @@ is equivalent to "implementation one", "implementation two", and: ``` external impl forall [T:! ImplicitAs(Meters)] T as MultipliableWith(f64) where .Result = Meters { - fn Multiply[self: Self](other: f64) -> Result { - // Will implicitly convert `self` to `Meters` in order to + fn Multiply[me: Self](other: f64) -> Result { + // Will implicitly convert `me` to `Meters` in order to // match the signature of this `Multiply` method. - return self.(Meters.(MultipliableWith(f64).Multiply))(other); + return me.(Meters.(MultipliableWith(f64).Multiply))(other); } } ``` @@ -5332,7 +5332,7 @@ there is one from `Vector(T)` to `Vector(String)`, so the following use of ``` // ❌ Illegal: Can't convert a value with type // `Vector(T:! ImplicitAs(String))` -// to `Vector(String)` for `self` +// to `Vector(String)` for `me` // parameter of `Printable.Print`. external impl Vector(like String) as Printable; ``` @@ -5388,7 +5388,7 @@ class HashMap( // `Self` is `HashMap(KeyType, ValueType)`. // Parameters may be used in function signatures. - fn Insert[addr self: Self*](k: KeyType, v: ValueType); + fn Insert[addr me: Self*](k: KeyType, v: ValueType); // Parameters may be used in field types. private var buckets: Vector((KeyType, ValueType)); diff --git a/docs/design/generics/overview.md b/docs/design/generics/overview.md index 4ac286da86f07..449a6155b3447 100644 --- a/docs/design/generics/overview.md +++ b/docs/design/generics/overview.md @@ -159,7 +159,7 @@ Example: ``` interface Comparable { // `Less` is an associated method. - fn Less[self: Self](rhs: Self) -> Bool; + fn Less[me: Self](rhs: Self) -> Bool; } ``` @@ -192,7 +192,7 @@ Consider this interface: ``` interface Printable { - fn Print[self: Self](); + fn Print[me: Self](); } ``` @@ -209,7 +209,7 @@ class Song { // as `F`, are included as a part of the `Song` API. impl as Printable { // Could use `Self` in place of `Song` here. - fn Print[self: Song]() { ... } + fn Print[me: Song]() { ... } } } @@ -218,7 +218,7 @@ class Song { // the library defining `Song` or `Comparable`. external impl Song as Comparable { // Could use either `Self` or `Song` here. - fn Less[self: Self](rhs: Self) -> Bool { ... } + fn Less[me: Self](rhs: Self) -> Bool { ... } } ``` @@ -350,13 +350,13 @@ Interfaces can require other interfaces be implemented: ``` interface Equatable { - fn IsEqual[self: Self](rhs: Self) -> Bool; + fn IsEqual[me: Self](rhs: Self) -> Bool; } // `Iterable` requires that `Equatable` is implemented. interface Iterable { impl as Equatable; - fn Advance[addr self: Self*](); + fn Advance[addr me: Self*](); } ``` @@ -369,13 +369,13 @@ interface. // `Hashable` extends `Equatable`. interface Hashable { extends Equatable; - fn Hash[self: Self]() -> u64; + fn Hash[me: Self]() -> u64; } // `Hashable` is equivalent to: interface Hashable { impl as Equatable; alias IsEqual = Equatable.IsEqual; - fn Hash[self: Self]() -> u64; + fn Hash[me: Self]() -> u64; } ``` @@ -386,8 +386,8 @@ methods in the implementation of the derived interface. class Key { // ... impl as Hashable { - fn IsEqual[self: Key](rhs: Key) -> Bool { ... } - fn Hash[self: Key]() -> u64 { ... } + fn IsEqual[me: Key](rhs: Key) -> Bool { ... } + fn Hash[me: Key]() -> u64 { ... } } // No need to separately implement `Equatable`. } @@ -403,14 +403,14 @@ It gives you all the names that don't conflict. ``` interface Renderable { - fn GetCenter[self: Self]() -> (i32, i32); + fn GetCenter[me: Self]() -> (i32, i32); // Draw the object to the screen - fn Draw[self: Self](); + fn Draw[me: Self](); } interface EndOfGame { - fn SetWinner[addr self: Self*](player: i32); + fn SetWinner[addr me: Self*](player: i32); // Indicate the game was a draw - fn Draw[addr self: Self*](); + fn Draw[addr me: Self*](); } fn F[T:! Renderable & EndOfGame](game_state: T*) -> (i32, i32) { @@ -533,9 +533,9 @@ element types: ``` interface Stack { let ElementType:! Movable; - fn Push[addr self: Self*](value: ElementType); - fn Pop[addr self: Self*]() -> ElementType; - fn IsEmpty[addr self: Self*]() -> Bool; + fn Push[addr me: Self*](value: ElementType); + fn Pop[addr me: Self*]() -> ElementType; + fn IsEmpty[addr me: Self*]() -> Bool; } ``` @@ -561,7 +561,7 @@ those types to be different. An element in a hash map might have type ``` interface Equatable(T:! Type) { - fn IsEqual[self: Self](compare_to: T) -> Bool; + fn IsEqual[me: Self](compare_to: T) -> Bool; } ``` diff --git a/docs/design/generics/terminology.md b/docs/design/generics/terminology.md index 5579e335b9118..33d9ad7a41c9b 100644 --- a/docs/design/generics/terminology.md +++ b/docs/design/generics/terminology.md @@ -648,8 +648,8 @@ Interface type parameter example: ``` interface StackTP(ElementType:! Type) - fn Push[addr self: Self*](value: ElementType); - fn Pop[addr self: Self*]() -> ElementType; + fn Push[addr me: Self*](value: ElementType); + fn Pop[addr me: Self*]() -> ElementType; } ``` @@ -658,8 +658,8 @@ Associated type example: ``` interface StackAT { let ElementType:! Type; - fn Push[addr self: Self*](value: ElementType); - fn Pop[addr self: Self*]() -> ElementType; + fn Push[addr me: Self*](value: ElementType); + fn Pop[addr me: Self*]() -> ElementType; } ``` @@ -675,7 +675,7 @@ interface Container { // since this type is determined from the container type. let IteratorType:! Iterator; ... - fn Insert[addr self: Self*](position: IteratorType, value: ElementType); + fn Insert[addr me: Self*](position: IteratorType, value: ElementType); } class ListIterator(ElementType:! Type) { ... @@ -684,7 +684,7 @@ class ListIterator(ElementType:! Type) { class List(ElementType:! Type) { // Iterator type is determined by the container type. impl as Container where .IteratorType = ListIterator(ElementType) { - fn Insert[addr self: Self*](position: IteratorType, value: ElementType) { + fn Insert[addr me: Self*](position: IteratorType, value: ElementType) { ... } } @@ -703,7 +703,7 @@ another type: ``` interface Addable(T:! Type) { let ResultType:! Type; - fn Add[self: Self](rhs: T) -> ResultType; + fn Add[me: Self](rhs: T) -> ResultType; } ``` diff --git a/docs/design/lexical_conventions/words.md b/docs/design/lexical_conventions/words.md index c2fd8befb78bd..4e42faec8036a 100644 --- a/docs/design/lexical_conventions/words.md +++ b/docs/design/lexical_conventions/words.md @@ -76,7 +76,6 @@ The following words are interpreted as keywords: - `protected` - `return` - `returned` -- `self` - `then` - `var` - `virtual` diff --git a/docs/design/templates.md b/docs/design/templates.md index 013eef15c7a55..7377e68ed4941 100644 --- a/docs/design/templates.md +++ b/docs/design/templates.md @@ -47,8 +47,8 @@ bound early to the extent possible. For example: class Stack(template T:! Type) { var storage: Array(T); - fn Push[addr self: Self*](value: T); - fn Pop[addr self: Self*]() -> T; + fn Push[addr me: Self*](value: T); + fn Pop[addr me: Self*]() -> T; } ``` diff --git a/explorer/ast/declaration.cpp b/explorer/ast/declaration.cpp index 874791a44e036..5f82e8a5aa1e4 100644 --- a/explorer/ast/declaration.cpp +++ b/explorer/ast/declaration.cpp @@ -202,14 +202,14 @@ void ReturnTerm::Print(llvm::raw_ostream& out) const { auto FunctionDeclaration::Create(Nonnull arena, SourceLocation source_loc, std::string name, std::vector> deduced_params, - std::optional> self_pattern, + std::optional> me_pattern, Nonnull param_pattern, ReturnTerm return_term, std::optional> body) -> ErrorOr> { std::vector> resolved_params; - // Look for the `self` parameter in the `deduced_parameters` - // and put it in the `self_pattern`. + // Look for the `me` parameter in the `deduced_parameters` + // and put it in the `me_pattern`. for (Nonnull param : deduced_params) { switch (param->kind()) { case AstNodeKind::GenericBinding: @@ -217,21 +217,21 @@ auto FunctionDeclaration::Create(Nonnull arena, break; case AstNodeKind::BindingPattern: { Nonnull bp = &cast(*param); - if (self_pattern.has_value() || bp->name() != "self") { + if (me_pattern.has_value() || bp->name() != "me") { return CompilationError(source_loc) << "illegal binding pattern in implicit parameter list"; } - self_pattern = bp; + me_pattern = bp; break; } case AstNodeKind::AddrPattern: { Nonnull abp = &cast(*param); Nonnull bp = &cast(abp->binding()); - if (self_pattern.has_value() || bp->name() != "self") { + if (me_pattern.has_value() || bp->name() != "me") { return CompilationError(source_loc) << "illegal binding pattern in implicit parameter list"; } - self_pattern = abp; + me_pattern = abp; break; } default: @@ -239,9 +239,9 @@ auto FunctionDeclaration::Create(Nonnull arena, << "illegal AST node in implicit parameter list"; } } - return arena->New( - source_loc, name, std::move(resolved_params), self_pattern, param_pattern, - return_term, body); + return arena->New(source_loc, name, + std::move(resolved_params), me_pattern, + param_pattern, return_term, body); } void FunctionDeclaration::PrintDepth(int depth, llvm::raw_ostream& out) const { diff --git a/explorer/ast/declaration.h b/explorer/ast/declaration.h index 39c5870ed4529..ad5820b1aa7d6 100644 --- a/explorer/ast/declaration.h +++ b/explorer/ast/declaration.h @@ -107,7 +107,7 @@ class FunctionDeclaration : public Declaration { static auto Create(Nonnull arena, SourceLocation source_loc, std::string name, std::vector> deduced_params, - std::optional> self_pattern, + std::optional> me_pattern, Nonnull param_pattern, ReturnTerm return_term, std::optional> body) @@ -116,14 +116,14 @@ class FunctionDeclaration : public Declaration { // Use `Create()` instead. This is public only so Arena::New() can call it. FunctionDeclaration(SourceLocation source_loc, std::string name, std::vector> deduced_params, - std::optional> self_pattern, + std::optional> me_pattern, Nonnull param_pattern, ReturnTerm return_term, std::optional> body) : Declaration(AstNodeKind::FunctionDeclaration, source_loc), name_(std::move(name)), deduced_parameters_(std::move(deduced_params)), - self_pattern_(self_pattern), + me_pattern_(me_pattern), param_pattern_(param_pattern), return_term_(return_term), body_(body) {} @@ -142,8 +142,8 @@ class FunctionDeclaration : public Declaration { auto deduced_parameters() -> llvm::ArrayRef> { return deduced_parameters_; } - auto self_pattern() const -> const Pattern& { return **self_pattern_; } - auto self_pattern() -> Pattern& { return **self_pattern_; } + auto me_pattern() const -> const Pattern& { return **me_pattern_; } + auto me_pattern() -> Pattern& { return **me_pattern_; } auto param_pattern() const -> const TuplePattern& { return *param_pattern_; } auto param_pattern() -> TuplePattern& { return *param_pattern_; } auto return_term() const -> const ReturnTerm& { return return_term_; } @@ -153,12 +153,12 @@ class FunctionDeclaration : public Declaration { auto value_category() const -> ValueCategory { return ValueCategory::Let; } - auto is_method() const -> bool { return self_pattern_.has_value(); } + auto is_method() const -> bool { return me_pattern_.has_value(); } private: std::string name_; std::vector> deduced_parameters_; - std::optional> self_pattern_; + std::optional> me_pattern_; Nonnull param_pattern_; ReturnTerm return_term_; std::optional> body_; diff --git a/explorer/ast/expression.h b/explorer/ast/expression.h index 190862a469d11..e9b1331399f44 100644 --- a/explorer/ast/expression.h +++ b/explorer/ast/expression.h @@ -222,7 +222,7 @@ class SimpleMemberAccessExpression : public Expression { member_ = member; } - // Returns true if the field is a method that has a "self" declaration in an + // Returns true if the field is a method that has a "me" declaration in an // AddrPattern. auto is_field_addr_me_method() const -> bool { return is_field_addr_me_method_; diff --git a/explorer/data/prelude.carbon b/explorer/data/prelude.carbon index 2c4bde64fa569..e06202efaa628 100644 --- a/explorer/data/prelude.carbon +++ b/explorer/data/prelude.carbon @@ -6,45 +6,45 @@ package Carbon api; // Explicitly convert `Self` to `T`. interface As(T:! Type) { - fn Convert[self: Self]() -> T; + fn Convert[me: Self]() -> T; } // Implicitly convert `Self` to `T`. interface ImplicitAs(T:! Type) { - fn Convert[self: Self]() -> T; + fn Convert[me: Self]() -> T; } // TODO: ImplicitAs(T) should extend As(T). impl forall [T:! Type, U:! ImplicitAs(T)] U as As(T) { - fn Convert[self: Self]() -> T { return self.Convert(); } + fn Convert[me: Self]() -> T { return me.Convert(); } } // Every type implicitly converts to itself. impl forall [T:! Type] T as ImplicitAs(T) { - fn Convert[self: Self]() -> T { return self; } + fn Convert[me: Self]() -> T { return me; } } // TODO: Simplify this once we have variadics. // TODO: Should these be final? impl forall [U1:! Type, T1:! ImplicitAs(U1)] (T1,) as ImplicitAs((U1,)) { - fn Convert[self: Self]() -> (U1,) { - let (v1: T1,) = self; + fn Convert[me: Self]() -> (U1,) { + let (v1: T1,) = me; return (v1.Convert(),); } } impl forall [U1:! Type, U2:! Type, T1:! ImplicitAs(U1), T2:! ImplicitAs(U2)] (T1, T2) as ImplicitAs((U1, U2)) { - fn Convert[self: Self]() -> (U1, U2) { - let (v1: T1, v2: T2) = self; + fn Convert[me: Self]() -> (U1, U2) { + let (v1: T1, v2: T2) = me; return (v1.Convert(), v2.Convert()); } } impl forall [U1:! Type, U2:! Type, U3:! Type, T1:! ImplicitAs(U1), T2:! ImplicitAs(U2), T3:! ImplicitAs(U3)] (T1, T2, T3) as ImplicitAs((U1, U2, U3)) { - fn Convert[self: Self]() -> (U1, U2, U3) { - let (v1: T1, v2: T2, v3: T3) = self; + fn Convert[me: Self]() -> (U1, U2, U3) { + let (v1: T1, v2: T2, v3: T3) = me; return (v1.Convert(), v2.Convert(), v3.Convert()); } } @@ -57,10 +57,10 @@ impl forall [U1:! Type, U2:! Type, U3:! Type, // } class Heap { - fn New[T:! Type, self: Self](x : T) -> T* { + fn New[T:! Type, me: Self](x : T) -> T* { return __intrinsic_new(x); } - fn Delete[T:! Type, self: Self](p : T*) { + fn Delete[T:! Type, me: Self](p : T*) { __intrinsic_delete(p); } } diff --git a/explorer/fuzzing/ast_to_proto.cpp b/explorer/fuzzing/ast_to_proto.cpp index 80a2aae7e19f5..d14e0c7ddbf5c 100644 --- a/explorer/fuzzing/ast_to_proto.cpp +++ b/explorer/fuzzing/ast_to_proto.cpp @@ -544,22 +544,21 @@ static auto DeclarationToProto(const Declaration& declaration) GenericBindingToProto(*binding); } if (function.is_method()) { - switch (function.self_pattern().kind()) { + switch (function.me_pattern().kind()) { case PatternKind::AddrPattern: - *function_proto->mutable_self_pattern() = - PatternToProto(cast(function.self_pattern())); + *function_proto->mutable_me_pattern() = + PatternToProto(cast(function.me_pattern())); break; case PatternKind::BindingPattern: - *function_proto->mutable_self_pattern() = - PatternToProto(cast(function.self_pattern())); + *function_proto->mutable_me_pattern() = + PatternToProto(cast(function.me_pattern())); break; default: - // Parser shouldn't allow self_pattern to be anything other than + // Parser shouldn't allow me_pattern to be anything other than // AddrPattern or BindingPattern - CARBON_FATAL() - << "self_pattern in method declaration can be either " - "AddrPattern or BindingPattern. Actual pattern: " - << function.self_pattern(); + CARBON_FATAL() << "me_pattern in method declaration can be either " + "AddrPattern or BindingPattern. Actual pattern: " + << function.me_pattern(); break; } } diff --git a/explorer/fuzzing/fuzzer_corpus/07c99567d27dcd6d7046c7dd7c12f09c2ddf2c9e b/explorer/fuzzing/fuzzer_corpus/07c99567d27dcd6d7046c7dd7c12f09c2ddf2c9e deleted file mode 100644 index 7cccd17fa6436..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/07c99567d27dcd6d7046c7dd7c12f09c2ddf2c9e +++ /dev/null @@ -1,300 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "LazyNe" - members { - variable { - binding { - name: "v1" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "v2" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Self" - } - } - interface { - call { - function { - identifier { - name: "ImplicitAs" - } - } - argument { - tuple_literal { - fields { - bool_type_literal { - } - } - } - } - } - } - members { - function { - name: "Convert" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - bool_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - operator { - op: Not - arguments { - operator { - op: Eq - arguments { - simple_member_access { - field: "v1" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "v2" - object { - identifier { - name: "self" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Make" - param_pattern { - fields { - binding_pattern { - name: "v1" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - fields { - binding_pattern { - name: "v2" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "v1" - expression { - identifier { - name: "v1" - } - } - } - fields { - name: "v2" - expression { - identifier { - name: "v2" - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "x" - type { - auto_pattern { - } - } - } - } - init { - int_literal { - value: 2 - } - } - } - } - statements { - while_statement { - condition { - call { - function { - simple_member_access { - field: "Make" - object { - identifier { - name: "LazyNe" - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "x" - } - } - fields { - int_literal { - value: 0 - } - } - } - } - } - } - body { - statements { - assign { - lhs { - identifier { - name: "x" - } - } - rhs { - operator { - op: Sub - arguments { - identifier { - name: "x" - } - } - arguments { - int_literal { - value: 1 - } - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - identifier { - name: "x" - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/091bf8f8567d807470ee5ef92b2b8659a0dfdfc3 b/explorer/fuzzing/fuzzer_corpus/091bf8f8567d807470ee5ef92b2b8659a0dfdfc3 deleted file mode 100644 index 0bc2194e4c478..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/091bf8f8567d807470ee5ef92b2b8659a0dfdfc3 +++ /dev/null @@ -1,857 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Number" - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "other" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - type_params { - fields { - generic_binding { - name: "T" - type { - identifier { - name: "Number" - } - } - } - } - } - } - } - declarations { - impl { - kind: ExternalImpl - impl_type { - int_type_literal { - } - } - interface { - identifier { - name: "Number" - } - } - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "other" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - operator { - op: Add - arguments { - identifier { - name: "self" - } - } - arguments { - identifier { - name: "other" - } - } - } - } - } - } - } - } - } - } - } - declarations { - impl { - kind: ExternalImpl - impl_type { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "U" - } - } - } - } - } - } - interface { - identifier { - name: "Number" - } - } - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "U" - } - } - } - } - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "U" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - fields { - name: "y" - expression { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "U" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "U" - } - } - } - } - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "other" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "U" - } - } - } - } - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "U" - } - } - } - } - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - call { - function { - simple_member_access { - field: "Add" - object { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - } - } - argument { - tuple_literal { - fields { - simple_member_access { - field: "x" - object { - identifier { - name: "other" - } - } - } - } - } - } - } - } - } - fields { - name: "y" - expression { - call { - function { - simple_member_access { - field: "Add" - object { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - } - } - argument { - tuple_literal { - fields { - simple_member_access { - field: "y" - object { - identifier { - name: "other" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Sum" - deduced_parameters { - name: "E" - type { - identifier { - name: "Number" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "E" - } - } - } - } - } - } - fields { - binding_pattern { - name: "y" - type { - expression_pattern { - expression { - identifier { - name: "E" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "E" - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "total" - type { - expression_pattern { - expression { - identifier { - name: "E" - } - } - } - } - } - } - init { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "E" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - statements { - assign { - lhs { - identifier { - name: "total" - } - } - rhs { - call { - function { - simple_member_access { - field: "Add" - object { - identifier { - name: "total" - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "x" - } - } - } - } - } - } - } - } - statements { - assign { - lhs { - identifier { - name: "total" - } - } - rhs { - call { - function { - simple_member_access { - field: "Add" - object { - identifier { - name: "total" - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "y" - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - identifier { - name: "total" - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 1 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 2 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "q" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 4 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 3 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "r" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "Sum" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "p" - } - } - fields { - identifier { - name: "q" - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Sub - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "r" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "r" - } - } - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/0c1ae47ddcb696f04e02513d439f4a54921f08f3 b/explorer/fuzzing/fuzzer_corpus/0c1ae47ddcb696f04e02513d439f4a54921f08f3 deleted file mode 100644 index f167b23cecfb6..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/0c1ae47ddcb696f04e02513d439f4a54921f08f3 +++ /dev/null @@ -1,645 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Vector" - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Point" - } - } - interface { - identifier { - name: "Vector" - } - } - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 0 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "AddAndScaleGeneric" - deduced_parameters { - name: "T" - type { - identifier { - name: "Vector" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "s" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "Scale" - object { - call { - function { - simple_member_access { - field: "Add" - object { - identifier { - name: "a" - } - } - } - } - argument { - tuple_literal { - fields { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "T" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "s" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 2 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "AddAndScaleGeneric" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "a" - } - } - fields { - int_literal { - value: 5 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Sub - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "p" - } - } - } - } - arguments { - int_literal { - value: 10 - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/10262aa9c545ac25ae1cd7ccd0cdd7ad758ad1d8 b/explorer/fuzzing/fuzzer_corpus/10262aa9c545ac25ae1cd7ccd0cdd7ad758ad1d8 deleted file mode 100644 index 926b69819fdca..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/10262aa9c545ac25ae1cd7ccd0cdd7ad758ad1d8 +++ /dev/null @@ -1,183 +0,0 @@ -compilation_unit { - package_statement { - package_name: "Foo" - } - is_api: true - declarations { - interface { - name: "A" - members { - function { - name: "F" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "X" - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Self" - } - } - interface { - identifier { - name: "A" - } - } - members { - function { - name: "F" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "X" - } - } - } - } - } - } - init { - struct_type_literal { - } - } - } - } - statements { - return_statement { - expression { - call { - function { - compound_member_access { - object { - identifier { - name: "a" - } - } - path { - compound_member_access { - object { - identifier { - name: "X" - } - } - path { - simple_member_access { - field: "F" - object { - identifier { - name: "A" - } - } - } - } - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/11d859d1c6b9ea0262e5fab224758bd6c34bed14 b/explorer/fuzzing/fuzzer_corpus/11d859d1c6b9ea0262e5fab224758bd6c34bed14 deleted file mode 100644 index d5d8b61a42785..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/11d859d1c6b9ea0262e5fab224758bd6c34bed14 +++ /dev/null @@ -1,1104 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Vector" - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point1" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Point1" - } - } - interface { - identifier { - name: "Vector" - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point1" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point1" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point1" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point1" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point1" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - class_declaration { - name: "Point2" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Point2" - } - } - interface { - identifier { - name: "Vector" - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point2" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point2" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point2" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Add - arguments { - operator { - op: Add - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "b" - } - } - } - } - } - } - arguments { - int_literal { - value: 1 - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Add - arguments { - operator { - op: Add - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "b" - } - } - } - } - } - } - arguments { - int_literal { - value: 1 - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point2" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point2" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Mul - arguments { - operator { - op: Mul - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - arguments { - int_literal { - value: 2 - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Mul - arguments { - operator { - op: Mul - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - arguments { - int_literal { - value: 2 - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "ScaleGeneric" - deduced_parameters { - name: "U" - type { - identifier { - name: "Vector" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "c" - type { - expression_pattern { - expression { - identifier { - name: "U" - } - } - } - } - } - } - fields { - binding_pattern { - name: "s" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "U" - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "Scale" - object { - identifier { - name: "c" - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "s" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "AddAndScaleGeneric" - deduced_parameters { - name: "T" - type { - identifier { - name: "Vector" - } - } - } - deduced_parameters { - name: "V" - type { - identifier { - name: "Vector" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "V" - } - } - } - } - } - } - fields { - binding_pattern { - name: "s" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - tuple_literal { - fields { - identifier { - name: "T" - } - } - fields { - identifier { - name: "V" - } - } - } - } - } - body { - statements { - return_statement { - expression { - tuple_literal { - fields { - call { - function { - identifier { - name: "ScaleGeneric" - } - } - argument { - tuple_literal { - fields { - call { - function { - simple_member_access { - field: "Add" - object { - identifier { - name: "a" - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "a" - } - } - } - } - } - } - fields { - identifier { - name: "s" - } - } - } - } - } - } - fields { - call { - function { - identifier { - name: "ScaleGeneric" - } - } - argument { - tuple_literal { - fields { - call { - function { - simple_member_access { - field: "Add" - object { - identifier { - name: "b" - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "b" - } - } - } - } - } - } - fields { - identifier { - name: "s" - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "Point1" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 1 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point2" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 2 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 3 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - tuple_pattern { - fields { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - identifier { - name: "Point1" - } - } - } - } - } - } - fields { - binding_pattern { - name: "q" - type { - expression_pattern { - expression { - identifier { - name: "Point2" - } - } - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "AddAndScaleGeneric" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "a" - } - } - fields { - identifier { - name: "b" - } - } - fields { - int_literal { - value: 5 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Sub - arguments { - operator { - op: Sub - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "q" - } - } - } - } - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "p" - } - } - } - } - } - } - arguments { - int_literal { - value: 40 - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/1691a7876803b03fa4e932b9e4b3cd370910b27c b/explorer/fuzzing/fuzzer_corpus/1691a7876803b03fa4e932b9e4b3cd370910b27c deleted file mode 100644 index 8b47290733715..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/1691a7876803b03fa4e932b9e4b3cd370910b27c +++ /dev/null @@ -1,700 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Vector" - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Point" - } - } - interface { - identifier { - name: "Vector" - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "AddAndScaleGeneric" - deduced_parameters { - name: "T" - type { - identifier { - name: "Vector" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "s" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "m" - type { - expression_pattern { - expression { - function_type { - parameter { - fields { - identifier { - name: "T" - } - } - } - return_type { - identifier { - name: "T" - } - } - } - } - } - } - } - } - init { - simple_member_access { - field: "Add" - object { - identifier { - name: "a" - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "n" - type { - expression_pattern { - expression { - function_type { - parameter { - fields { - int_type_literal { - } - } - } - return_type { - identifier { - name: "T" - } - } - } - } - } - } - } - } - init { - simple_member_access { - field: "Scale" - object { - call { - function { - identifier { - name: "m" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - call { - function { - identifier { - name: "n" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "s" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 1 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 2 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 3 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "AddAndScaleGeneric" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "a" - } - } - fields { - identifier { - name: "b" - } - } - fields { - int_literal { - value: 5 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Sub - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "p" - } - } - } - } - arguments { - int_literal { - value: 15 - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/1b50f0f95f834081ac26a707b5ed161079fac7a9 b/explorer/fuzzing/fuzzer_corpus/1b50f0f95f834081ac26a707b5ed161079fac7a9 deleted file mode 100644 index fc247a47d23ee..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/1b50f0f95f834081ac26a707b5ed161079fac7a9 +++ /dev/null @@ -1,1098 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "AddMul" - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "o" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Mul" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "o" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - impl { - kind: ExternalImpl - impl_type { - int_type_literal { - } - } - interface { - identifier { - name: "AddMul" - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "o" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - operator { - op: Add - arguments { - identifier { - name: "self" - } - } - arguments { - identifier { - name: "o" - } - } - } - } - } - } - } - } - } - members { - function { - name: "Mul" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "o" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - operator { - op: Mul - arguments { - identifier { - name: "self" - } - } - arguments { - identifier { - name: "o" - } - } - } - } - } - } - } - } - } - } - } - declarations { - class_declaration { - name: "Holder" - members { - variable { - binding { - name: "v" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - type_params { - fields { - generic_binding { - name: "T" - type { - identifier { - name: "AddMul" - } - } - } - } - } - } - } - declarations { - interface { - name: "Vector" - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - identifier { - name: "Scalar" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Hold" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - identifier { - name: "Scalar" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - call { - function { - identifier { - name: "Holder" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "Scalar" - } - } - } - } - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Point" - } - } - interface { - call { - function { - identifier { - name: "Vector" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 0 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Hold" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - call { - function { - identifier { - name: "Holder" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "v" - expression { - identifier { - name: "v" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "AddAndScaleGeneric" - deduced_parameters { - name: "T" - type { - identifier { - name: "AddMul" - } - } - } - deduced_parameters { - name: "U" - type { - call { - function { - identifier { - name: "Vector" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "U" - } - } - } - } - } - } - fields { - binding_pattern { - name: "s" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "U" - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "Scale" - object { - call { - function { - simple_member_access { - field: "Add" - object { - identifier { - name: "a" - } - } - } - } - argument { - tuple_literal { - fields { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "U" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } - } - argument { - tuple_literal { - fields { - simple_member_access { - field: "v" - object { - call { - function { - simple_member_access { - field: "Hold" - object { - identifier { - name: "a" - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "s" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 2 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "AddAndScaleGeneric" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "a" - } - } - fields { - int_literal { - value: 5 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Sub - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "p" - } - } - } - } - arguments { - int_literal { - value: 10 - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/26dc885153b426df9c1695ccd09a152eb39d744e b/explorer/fuzzing/fuzzer_corpus/26dc885153b426df9c1695ccd09a152eb39d744e deleted file mode 100644 index c14b8b8390516..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/26dc885153b426df9c1695ccd09a152eb39d744e +++ /dev/null @@ -1,805 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Number" - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "other" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - type_params { - fields { - generic_binding { - name: "T" - type { - identifier { - name: "Number" - } - } - } - } - } - } - } - declarations { - impl { - kind: ExternalImpl - impl_type { - int_type_literal { - } - } - interface { - identifier { - name: "Number" - } - } - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "other" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - operator { - op: Add - arguments { - identifier { - name: "self" - } - } - arguments { - identifier { - name: "other" - } - } - } - } - } - } - } - } - } - } - } - declarations { - impl { - kind: ExternalImpl - impl_type { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "U" - } - } - } - } - } - } - interface { - identifier { - name: "Number" - } - } - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "U" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - fields { - name: "y" - expression { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "U" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "other" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - call { - function { - simple_member_access { - field: "Add" - object { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - } - } - argument { - tuple_literal { - fields { - simple_member_access { - field: "x" - object { - identifier { - name: "other" - } - } - } - } - } - } - } - } - } - fields { - name: "y" - expression { - call { - function { - simple_member_access { - field: "Add" - object { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - } - } - argument { - tuple_literal { - fields { - simple_member_access { - field: "y" - object { - identifier { - name: "other" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Sum" - deduced_parameters { - name: "E" - type { - identifier { - name: "Number" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "E" - } - } - } - } - } - } - fields { - binding_pattern { - name: "y" - type { - expression_pattern { - expression { - identifier { - name: "E" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "E" - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "total" - type { - expression_pattern { - expression { - identifier { - name: "E" - } - } - } - } - } - } - init { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "E" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - statements { - assign { - lhs { - identifier { - name: "total" - } - } - rhs { - call { - function { - simple_member_access { - field: "Add" - object { - identifier { - name: "total" - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "x" - } - } - } - } - } - } - } - } - statements { - assign { - lhs { - identifier { - name: "total" - } - } - rhs { - call { - function { - simple_member_access { - field: "Add" - object { - identifier { - name: "total" - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "y" - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - identifier { - name: "total" - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 1 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 2 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "q" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 4 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 3 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "r" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "Sum" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "p" - } - } - fields { - identifier { - name: "q" - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Sub - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "r" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "r" - } - } - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/281e1ca9619c28362d8674aceda9fff50b3892fb b/explorer/fuzzing/fuzzer_corpus/281e1ca9619c28362d8674aceda9fff50b3892fb deleted file mode 100644 index 0aac14465a188..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/281e1ca9619c28362d8674aceda9fff50b3892fb +++ /dev/null @@ -1,233 +0,0 @@ -compilation_unit { - package_statement { - package_name: "Foo" - } - is_api: true - declarations { - class_declaration { - name: "X" - members { - function { - name: "F" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "o" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "n" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "n" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "n" - object { - identifier { - name: "o" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - variable { - binding { - name: "n" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - identifier { - name: "X" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "n" - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "w" - type { - expression_pattern { - expression { - identifier { - name: "X" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "n" - expression { - int_literal { - value: 2 - } - } - } - } - } - } - } - statements { - return_statement { - expression { - compound_member_access { - object { - call { - function { - compound_member_access { - object { - identifier { - name: "v" - } - } - path { - simple_member_access { - field: "F" - object { - identifier { - name: "X" - } - } - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "w" - } - } - } - } - } - } - path { - simple_member_access { - field: "n" - object { - identifier { - name: "X" - } - } - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/2b19e350556fbbc1d4821da650b3cf0d17148ae9 b/explorer/fuzzing/fuzzer_corpus/2b19e350556fbbc1d4821da650b3cf0d17148ae9 deleted file mode 100644 index 18c712b83b545..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/2b19e350556fbbc1d4821da650b3cf0d17148ae9 +++ /dev/null @@ -1,270 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "Point" - members { - function { - name: "Origin" - param_pattern { - fields { - binding_pattern { - name: "zero" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - identifier { - name: "zero" - } - } - } - fields { - name: "y" - expression { - identifier { - name: "zero" - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "GetX" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - return_statement { - expression { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - } - } - } - } - } - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - type_params { - fields { - generic_binding { - name: "T" - type { - type_type_literal { - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - call { - function { - simple_member_access { - field: "Origin" - object { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - argument { - tuple_literal { - fields { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "GetX" - object { - identifier { - name: "p" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/2b3791b3cd55ea889bb2ab7c54571506788e1ca9 b/explorer/fuzzing/fuzzer_corpus/2b3791b3cd55ea889bb2ab7c54571506788e1ca9 deleted file mode 100644 index 45390abcac984..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/2b3791b3cd55ea889bb2ab7c54571506788e1ca9 +++ /dev/null @@ -1,766 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Vector" - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - type_params { - fields { - generic_binding { - name: "T" - type { - type_type_literal { - } - } - } - } - } - } - } - declarations { - impl { - kind: ExternalImpl - impl_type { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - interface { - identifier { - name: "Vector" - } - } - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 0 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "AddAndScaleGeneric" - deduced_parameters { - name: "T" - type { - identifier { - name: "Vector" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "s" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "Scale" - object { - call { - function { - simple_member_access { - field: "Add" - object { - identifier { - name: "a" - } - } - } - } - argument { - tuple_literal { - fields { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "T" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "s" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 2 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "AddAndScaleGeneric" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "a" - } - } - fields { - int_literal { - value: 5 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Sub - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "p" - } - } - } - } - arguments { - int_literal { - value: 10 - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/304589d53b5ac70ae5b20bfb211e9ef2ef89c303 b/explorer/fuzzing/fuzzer_corpus/304589d53b5ac70ae5b20bfb211e9ef2ef89c303 deleted file mode 100644 index 1e74769df6c02..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/304589d53b5ac70ae5b20bfb211e9ef2ef89c303 +++ /dev/null @@ -1,247 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "A" - } - } - declarations { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "A" - } - } - interface { - call { - function { - identifier { - name: "ImplicitAs" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - members { - function { - name: "Convert" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "A" - } - } - } - } - } - } - init { - struct_type_literal { - } - } - } - } - statements { - match { - expression { - tuple_literal { - fields { - identifier { - name: "a" - } - } - fields { - identifier { - name: "a" - } - } - } - } - clauses { - pattern { - tuple_pattern { - fields { - expression_pattern { - expression { - int_literal { - value: 0 - } - } - } - } - fields { - binding_pattern { - name: "n" - type { - expression_pattern { - expression { - identifier { - name: "A" - } - } - } - } - } - } - } - } - statement { - return_statement { - expression { - int_literal { - value: 1 - } - } - } - } - } - clauses { - pattern { - tuple_pattern { - fields { - binding_pattern { - name: "n" - type { - expression_pattern { - expression { - identifier { - name: "A" - } - } - } - } - } - } - fields { - expression_pattern { - expression { - int_literal { - value: 0 - } - } - } - } - } - } - statement { - return_statement { - expression { - int_literal { - value: 1 - } - } - } - } - } - clauses { - pattern { - expression_pattern { - expression { - tuple_literal { - fields { - int_literal { - value: 1 - } - } - fields { - int_literal { - value: 1 - } - } - } - } - } - } - statement { - return_statement { - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - statements { - return_statement { - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/3090c90b834514f4dd338c2a22b63c25beb347c5 b/explorer/fuzzing/fuzzer_corpus/3090c90b834514f4dd338c2a22b63c25beb347c5 deleted file mode 100644 index 3d6cc61ee3132..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/3090c90b834514f4dd338c2a22b63c25beb347c5 +++ /dev/null @@ -1,411 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Vector" - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "AddAndScaleGeneric" - deduced_parameters { - name: "T" - type { - identifier { - name: "Vector" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "s" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "Scale" - object { - call { - function { - simple_member_access { - field: "Add" - object { - identifier { - name: "a" - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "b" - } - } - } - } - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "s" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 0 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 2 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 3 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "AddAndScaleGeneric" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "a" - } - } - fields { - identifier { - name: "b" - } - } - fields { - int_literal { - value: 3 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Sub - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "p" - } - } - } - } - arguments { - int_literal { - value: 6 - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/309601c5d0e404307e368b2582e13e55f6d51b1d b/explorer/fuzzing/fuzzer_corpus/309601c5d0e404307e368b2582e13e55f6d51b1d deleted file mode 100644 index c174fa104153c..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/309601c5d0e404307e368b2582e13e55f6d51b1d +++ /dev/null @@ -1,645 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Vector" - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Self" - } - } - interface { - identifier { - name: "Vector" - } - } - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 0 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "AddAndScaleGeneric" - deduced_parameters { - name: "T" - type { - identifier { - name: "Vector" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "s" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "Scale" - object { - call { - function { - simple_member_access { - field: "Add" - object { - identifier { - name: "a" - } - } - } - } - argument { - tuple_literal { - fields { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "T" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "s" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 2 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "AddAndScaleGeneric" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "a" - } - } - fields { - int_literal { - value: 5 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Sub - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "p" - } - } - } - } - arguments { - int_literal { - value: 10 - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/35de79f70854c62b8f4b02abb8877d7277f2e961 b/explorer/fuzzing/fuzzer_corpus/35de79f70854c62b8f4b02abb8877d7277f2e961 deleted file mode 100644 index 3e44f654cba6c..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/35de79f70854c62b8f4b02abb8877d7277f2e961 +++ /dev/null @@ -1,645 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Vector" - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Self" - } - } - interface { - identifier { - name: "Vector" - } - } - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 0 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "AddAndScaleGeneric" - deduced_parameters { - name: "T" - type { - identifier { - name: "Vector" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "s" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "Scale" - object { - call { - function { - simple_member_access { - field: "Add" - object { - identifier { - name: "a" - } - } - } - } - argument { - tuple_literal { - fields { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "T" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "s" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 2 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "AddAndScaleGeneric" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "a" - } - } - fields { - int_literal { - value: 5 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Sub - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "p" - } - } - } - } - arguments { - int_literal { - value: 10 - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/3bc84abaa7693f3ca0f0681f6f1097e1766d9d89 b/explorer/fuzzing/fuzzer_corpus/3bc84abaa7693f3ca0f0681f6f1097e1766d9d89 deleted file mode 100644 index bd2825da4344c..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/3bc84abaa7693f3ca0f0681f6f1097e1766d9d89 +++ /dev/null @@ -1,293 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "Point" - members { - function { - name: "Origin" - param_pattern { - fields { - binding_pattern { - name: "zero" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - fields { - identifier { - name: "T" - } - } - } - } - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - identifier { - name: "zero" - } - } - } - fields { - name: "y" - expression { - identifier { - name: "zero" - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "GetX" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - fields { - identifier { - name: "T" - } - } - } - } - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - return_statement { - expression { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - } - } - } - } - } - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - type_params { - fields { - generic_binding { - name: "T" - type { - type_type_literal { - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - call { - function { - simple_member_access { - field: "Origin" - object { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - argument { - tuple_literal { - fields { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "GetX" - object { - identifier { - name: "p" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/3ed8ca560ef34c454714552d051ec8d184dda8c3 b/explorer/fuzzing/fuzzer_corpus/3ed8ca560ef34c454714552d051ec8d184dda8c3 deleted file mode 100644 index 285823fdb67fb..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/3ed8ca560ef34c454714552d051ec8d184dda8c3 +++ /dev/null @@ -1,218 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "Point" - members { - function { - name: "Get" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - return_statement { - expression { - identifier { - name: "V" - } - } - } - } - } - } - } - type_params { - fields { - generic_binding { - name: "T" - type { - type_type_literal { - } - } - } - } - fields { - generic_binding { - name: "V" - type { - identifier { - name: "T" - } - } - } - } - } - } - } - declarations { - function { - name: "F" - param_pattern { - fields { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - fields { - int_literal { - value: 1 - } - } - } - } - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "Get" - object { - identifier { - name: "p" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - fields { - int_literal { - value: 1 - } - } - } - } - } - } - } - } - } - } - init { - struct_type_literal { - } - } - } - } - statements { - return_statement { - expression { - call { - function { - identifier { - name: "F" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "v" - } - } - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/46e4b415ad8248b7aeeaad245c8f541253193949 b/explorer/fuzzing/fuzzer_corpus/46e4b415ad8248b7aeeaad245c8f541253193949 deleted file mode 100644 index e8623d320fd15..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/46e4b415ad8248b7aeeaad245c8f541253193949 +++ /dev/null @@ -1,571 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Vector" - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Point" - } - } - interface { - identifier { - name: "Vector" - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "AddAndScaleGeneric" - deduced_parameters { - name: "T" - type { - identifier { - name: "Vector" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "s" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "m" - type { - auto_pattern { - } - } - } - } - init { - simple_member_access { - field: "Add" - object { - identifier { - name: "a" - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "n" - type { - auto_pattern { - } - } - } - } - init { - simple_member_access { - field: "Scale" - object { - call { - function { - identifier { - name: "m" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - call { - function { - identifier { - name: "n" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "s" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 0 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 2 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 3 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "AddAndScaleGeneric" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "a" - } - } - fields { - identifier { - name: "b" - } - } - fields { - int_literal { - value: 3 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Sub - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "p" - } - } - } - } - arguments { - int_literal { - value: 6 - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/47c8ce5c9e3190017234541803e0cb4df63a7813 b/explorer/fuzzing/fuzzer_corpus/47c8ce5c9e3190017234541803e0cb4df63a7813 deleted file mode 100644 index 37ec05ebb9f7f..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/47c8ce5c9e3190017234541803e0cb4df63a7813 +++ /dev/null @@ -1,345 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "Shape" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - function { - name: "Origin" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 0 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "GetSetX" - self_pattern { - addr_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - operator { - op: Ptr - arguments { - identifier { - name: "Shape" - } - } - } - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "old" - type { - auto_pattern { - } - } - } - } - init { - simple_member_access { - field: "x" - object { - operator { - op: Deref - arguments { - identifier { - name: "self" - } - } - } - } - } - } - } - } - statements { - assign { - lhs { - simple_member_access { - field: "x" - object { - operator { - op: Deref - arguments { - identifier { - name: "self" - } - } - } - } - } - } - rhs { - identifier { - name: "x" - } - } - } - } - statements { - return_statement { - expression { - identifier { - name: "old" - } - } - } - } - } - } - } - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - call { - function { - simple_member_access { - field: "Origin" - object { - identifier { - name: "Point" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "x" - type { - auto_pattern { - } - } - } - } - init { - call { - function { - simple_member_access { - field: "GetSetX" - object { - identifier { - name: "p" - } - } - } - } - argument { - tuple_literal { - fields { - int_literal { - value: 42 - } - } - } - } - } - } - } - } - statements { - if_statement { - condition { - operator { - op: Eq - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "p" - } - } - } - } - arguments { - int_literal { - value: 42 - } - } - } - } - then_block { - statements { - return_statement { - expression { - identifier { - name: "x" - } - } - } - } - } - } - } - statements { - return_statement { - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/48b1435c9df1e717046e6287b58fa56443ed1811 b/explorer/fuzzing/fuzzer_corpus/48b1435c9df1e717046e6287b58fa56443ed1811 deleted file mode 100644 index 07904cb4aab03..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/48b1435c9df1e717046e6287b58fa56443ed1811 +++ /dev/null @@ -1,669 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Vector" - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - declarations { - impl { - kind: ExternalImpl - impl_type { - identifier { - name: "Point" - } - } - interface { - identifier { - name: "Vector" - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "AddAndScaleGeneric" - deduced_parameters { - name: "T" - type { - identifier { - name: "Vector" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "s" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "m" - type { - auto_pattern { - } - } - } - } - init { - simple_member_access { - field: "Add" - object { - identifier { - name: "a" - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "n" - type { - auto_pattern { - } - } - } - } - init { - simple_member_access { - field: "Scale" - object { - call { - function { - identifier { - name: "m" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - call { - function { - identifier { - name: "n" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "s" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 1 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 4 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 2 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 3 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "AddAndScaleGeneric" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "a" - } - } - fields { - identifier { - name: "b" - } - } - fields { - int_literal { - value: 5 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Sub - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "p" - } - } - } - } - arguments { - int_literal { - value: 15 - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/4e336ef2a037f5b85a70defee2016d0e82ebde61 b/explorer/fuzzing/fuzzer_corpus/4e336ef2a037f5b85a70defee2016d0e82ebde61 deleted file mode 100644 index a5f6a55797726..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/4e336ef2a037f5b85a70defee2016d0e82ebde61 +++ /dev/null @@ -1,465 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "One" - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "One" - } - } - interface { - call { - function { - identifier { - name: "ImplicitAs" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - members { - function { - name: "Convert" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - } - } - } - } - declarations { - class_declaration { - name: "Two" - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Two" - } - } - interface { - call { - function { - identifier { - name: "ImplicitAs" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - members { - function { - name: "Convert" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - int_literal { - value: 2 - } - } - } - } - } - } - } - } - } - } - } - declarations { - class_declaration { - name: "N" - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "N" - } - } - interface { - call { - function { - identifier { - name: "ImplicitAs" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - members { - function { - name: "Convert" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - simple_member_access { - field: "n" - object { - identifier { - name: "self" - } - } - } - } - } - } - } - } - } - } - } - members { - variable { - binding { - name: "n" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Get" - param_pattern { - fields { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - fields { - binding_pattern { - name: "c" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - operator { - op: Add - arguments { - operator { - op: Add - arguments { - operator { - op: Mul - arguments { - int_literal { - value: 100 - } - } - arguments { - identifier { - name: "a" - } - } - } - } - arguments { - operator { - op: Mul - arguments { - int_literal { - value: 10 - } - } - arguments { - identifier { - name: "b" - } - } - } - } - } - } - arguments { - identifier { - name: "c" - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "i" - type { - expression_pattern { - expression { - identifier { - name: "One" - } - } - } - } - } - } - init { - struct_type_literal { - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "ii" - type { - expression_pattern { - expression { - identifier { - name: "Two" - } - } - } - } - } - } - init { - struct_type_literal { - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "iii" - type { - expression_pattern { - expression { - identifier { - name: "N" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "n" - expression { - int_literal { - value: 3 - } - } - } - } - } - } - } - statements { - return_statement { - expression { - call { - function { - identifier { - name: "Get" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "i" - } - } - fields { - identifier { - name: "ii" - } - } - fields { - identifier { - name: "iii" - } - } - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/503c9b96ee1cc78e58ec9b362db2bdac5e941119 b/explorer/fuzzing/fuzzer_corpus/503c9b96ee1cc78e58ec9b362db2bdac5e941119 deleted file mode 100644 index 54a25cc03dea0..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/503c9b96ee1cc78e58ec9b362db2bdac5e941119 +++ /dev/null @@ -1,324 +0,0 @@ -compilation_unit { - package_statement { - package_name: "Foo" - } - is_api: true - declarations { - class_declaration { - name: "X" - members { - function { - name: "F" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "o" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "n" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "n" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "n" - object { - identifier { - name: "o" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - variable { - binding { - name: "n" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - declarations { - class_declaration { - name: "Y" - members { - variable { - binding { - name: "m" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Self" - } - } - interface { - call { - function { - identifier { - name: "ImplicitAs" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "X" - } - } - } - } - } - } - members { - function { - name: "Convert" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "X" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "n" - expression { - simple_member_access { - field: "m" - object { - identifier { - name: "self" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "y1" - type { - expression_pattern { - expression { - identifier { - name: "Y" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "m" - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "y2" - type { - expression_pattern { - expression { - identifier { - name: "Y" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "m" - expression { - int_literal { - value: 2 - } - } - } - } - } - } - } - statements { - return_statement { - expression { - simple_member_access { - field: "n" - object { - call { - function { - compound_member_access { - object { - identifier { - name: "y1" - } - } - path { - simple_member_access { - field: "F" - object { - identifier { - name: "X" - } - } - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "y2" - } - } - } - } - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/54e9c97b2f7561cc205bc243927d1dbbbf753c16 b/explorer/fuzzing/fuzzer_corpus/54e9c97b2f7561cc205bc243927d1dbbbf753c16 deleted file mode 100644 index c707c879a119c..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/54e9c97b2f7561cc205bc243927d1dbbbf753c16 +++ /dev/null @@ -1,588 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Number" - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "other" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - function { - name: "Origin" - param_pattern { - } - return_term { - kind: Expression - type { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "T" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - fields { - name: "y" - expression { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "T" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Clone" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - } - fields { - name: "y" - expression { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "SumXY" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "Add" - object { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - } - } - argument { - tuple_literal { - fields { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - type_params { - fields { - generic_binding { - name: "T" - type { - identifier { - name: "Number" - } - } - } - } - } - } - } - declarations { - impl { - kind: ExternalImpl - impl_type { - int_type_literal { - } - } - interface { - identifier { - name: "Number" - } - } - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "other" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - operator { - op: Add - arguments { - identifier { - name: "self" - } - } - arguments { - identifier { - name: "other" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - call { - function { - simple_member_access { - field: "Origin" - object { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "SumXY" - object { - call { - function { - simple_member_access { - field: "Clone" - object { - identifier { - name: "p" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/5ad39cbb562bed711f6d6e8d44b631cb25881673 b/explorer/fuzzing/fuzzer_corpus/5ad39cbb562bed711f6d6e8d44b631cb25881673 deleted file mode 100644 index b0cb491dff414..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/5ad39cbb562bed711f6d6e8d44b631cb25881673 +++ /dev/null @@ -1,567 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Addable" - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "k" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - impl { - kind: InternalImpl - impl_type { - int_type_literal { - } - } - interface { - identifier { - name: "Addable" - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "k" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - body { - statements { - return_statement { - expression { - operator { - op: Add - arguments { - identifier { - name: "self" - } - } - arguments { - identifier { - name: "k" - } - } - } - } - } - } - } - } - } - } - } - declarations { - class_declaration { - name: "Class" - members { - variable { - binding { - name: "n" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - declarations { - class_declaration { - name: "GenericClass" - members { - variable { - binding { - name: "m" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - members { - function { - name: "Get" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "n" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "Add" - object { - simple_member_access { - field: "m" - object { - identifier { - name: "self" - } - } - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "n" - } - } - } - } - } - } - } - } - } - } - } - type_params { - fields { - generic_binding { - name: "T" - type { - identifier { - name: "Addable" - } - } - } - } - } - } - } - declarations { - alias { - name: "ClassAlias" - target { - identifier { - name: "Class" - } - } - } - } - declarations { - alias { - name: "GenericClassAlias" - target { - identifier { - name: "GenericClass" - } - } - } - } - declarations { - alias { - name: "ClassSpecializationAlias" - target { - call { - function { - identifier { - name: "GenericClassAlias" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "Class" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "n" - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "ClassAlias" - } - } - } - } - } - } - init { - identifier { - name: "a" - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "c" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "GenericClass" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "m" - expression { - int_literal { - value: 2 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "d" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "GenericClassAlias" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - identifier { - name: "c" - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "e" - type { - expression_pattern { - expression { - identifier { - name: "ClassSpecializationAlias" - } - } - } - } - } - } - init { - identifier { - name: "c" - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Add - arguments { - operator { - op: Add - arguments { - operator { - op: Mul - arguments { - int_literal { - value: 100 - } - } - arguments { - simple_member_access { - field: "n" - object { - identifier { - name: "b" - } - } - } - } - } - } - arguments { - operator { - op: Mul - arguments { - int_literal { - value: 10 - } - } - arguments { - call { - function { - simple_member_access { - field: "Get" - object { - identifier { - name: "d" - } - } - } - } - argument { - tuple_literal { - fields { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - } - } - arguments { - call { - function { - simple_member_access { - field: "Get" - object { - identifier { - name: "e" - } - } - } - } - argument { - tuple_literal { - fields { - int_literal { - value: 1 - } - } - } - } - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/5b0eabed769a089e9906772fe0dfc78b111fee38 b/explorer/fuzzing/fuzzer_corpus/5b0eabed769a089e9906772fe0dfc78b111fee38 deleted file mode 100644 index 2684c3348ecb1..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/5b0eabed769a089e9906772fe0dfc78b111fee38 +++ /dev/null @@ -1,110 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "A" - members { - function { - name: "F" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "A" - } - } - } - } - } - } - init { - struct_type_literal { - } - } - } - } - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "F" - object { - identifier { - name: "a" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/5f24e26f9bfacd281bc23e93f1cbdcb144743057 b/explorer/fuzzing/fuzzer_corpus/5f24e26f9bfacd281bc23e93f1cbdcb144743057 deleted file mode 100644 index 6b1fed18e0217..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/5f24e26f9bfacd281bc23e93f1cbdcb144743057 +++ /dev/null @@ -1,855 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Vector" - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - declarations { - impl { - kind: ExternalImpl - impl_type { - identifier { - name: "Point" - } - } - interface { - identifier { - name: "Vector" - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - impl { - kind: ExternalImpl - impl_type { - identifier { - name: "Point" - } - } - interface { - identifier { - name: "Vector" - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "AddAndScaleGeneric" - deduced_parameters { - name: "T" - type { - identifier { - name: "Vector" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "s" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "Scale" - object { - call { - function { - simple_member_access { - field: "Add" - object { - identifier { - name: "a" - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "b" - } - } - } - } - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "s" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 1 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 2 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 3 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "AddAndScaleGeneric" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "a" - } - } - fields { - identifier { - name: "b" - } - } - fields { - int_literal { - value: 5 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Sub - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "p" - } - } - } - } - arguments { - int_literal { - value: 15 - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/60d9b88eed255b0805f08ead84037690c554182b b/explorer/fuzzing/fuzzer_corpus/60d9b88eed255b0805f08ead84037690c554182b deleted file mode 100644 index 6115f6c704066..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/60d9b88eed255b0805f08ead84037690c554182b +++ /dev/null @@ -1,294 +0,0 @@ -compilation_unit { - package_statement { - package_name: "Foo" - } - is_api: true - declarations { - interface { - name: "A" - members { - function { - name: "F" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "o" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "X" - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Self" - } - } - interface { - identifier { - name: "A" - } - } - members { - function { - name: "F" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "o" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "n" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "n" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "n" - object { - identifier { - name: "o" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - variable { - binding { - name: "n" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - identifier { - name: "X" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "n" - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "w" - type { - expression_pattern { - expression { - identifier { - name: "X" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "n" - expression { - int_literal { - value: 2 - } - } - } - } - } - } - } - statements { - return_statement { - expression { - simple_member_access { - field: "n" - object { - call { - function { - compound_member_access { - object { - identifier { - name: "v" - } - } - path { - simple_member_access { - field: "F" - object { - identifier { - name: "A" - } - } - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "w" - } - } - } - } - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/6318884693dd31430b4b46b1305dae63f281751e b/explorer/fuzzing/fuzzer_corpus/6318884693dd31430b4b46b1305dae63f281751e deleted file mode 100644 index 8991d91d8e696..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/6318884693dd31430b4b46b1305dae63f281751e +++ /dev/null @@ -1,164 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "Point" - members { - function { - name: "Origin" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 0 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "GetX" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - } - } - } - } - } - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "GetX" - object { - identifier { - name: "Point" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/68a5800e6a2dbe2f732129fe874f20bbb42b90b5 b/explorer/fuzzing/fuzzer_corpus/68a5800e6a2dbe2f732129fe874f20bbb42b90b5 deleted file mode 100644 index a1f611f515f53..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/68a5800e6a2dbe2f732129fe874f20bbb42b90b5 +++ /dev/null @@ -1,180 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "HasValueParam" - members { - function { - name: "Go" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - impl { - kind: InternalImpl - impl_type { - tuple_literal { - } - } - interface { - call { - function { - identifier { - name: "HasValueParam" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - fields { - int_literal { - value: 5 - } - } - } - } - } - } - members { - function { - name: "Go" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - int_literal { - value: 42 - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - compound_member_access { - object { - tuple_literal { - } - } - path { - simple_member_access { - field: "Go" - object { - call { - function { - identifier { - name: "HasValueParam" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - fields { - int_literal { - value: 5 - } - } - } - } - } - } - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/6a879cdde713ac9009864ed5f9912616d314e017 b/explorer/fuzzing/fuzzer_corpus/6a879cdde713ac9009864ed5f9912616d314e017 deleted file mode 100644 index ed7f4eb953422..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/6a879cdde713ac9009864ed5f9912616d314e017 +++ /dev/null @@ -1,309 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "Point" - members { - function { - name: "Origin" - param_pattern { - fields { - binding_pattern { - name: "zero" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - call { - function { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - identifier { - name: "zero" - } - } - } - fields { - name: "y" - expression { - identifier { - name: "zero" - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "GetX" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - call { - function { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - return_statement { - expression { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - } - } - } - } - } - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - type_params { - fields { - generic_binding { - name: "T" - type { - type_type_literal { - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - call { - function { - simple_member_access { - field: "Origin" - object { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - argument { - tuple_literal { - fields { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "GetX" - object { - identifier { - name: "p" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/6b308c0cf9835a750f16ee9aad989601b18c750b b/explorer/fuzzing/fuzzer_corpus/6b308c0cf9835a750f16ee9aad989601b18c750b deleted file mode 100644 index 1e9cab0acd978..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/6b308c0cf9835a750f16ee9aad989601b18c750b +++ /dev/null @@ -1,1124 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "I" - members { - function { - name: "F" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - } - } - members { - function { - name: "M" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "A" - members { - variable { - binding { - name: "n" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Self" - } - } - interface { - identifier { - name: "I" - } - } - members { - function { - name: "F" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - members { - function { - name: "M" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - int_literal { - value: 2 - } - } - } - } - } - } - } - } - } - members { - function { - name: "G" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - int_literal { - value: 3 - } - } - } - } - } - } - } - } - } - declarations { - impl { - kind: InternalImpl - impl_type { - int_type_literal { - } - } - interface { - identifier { - name: "I" - } - } - members { - function { - name: "F" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - int_literal { - value: 4 - } - } - } - } - } - } - } - members { - function { - name: "M" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - int_literal { - value: 5 - } - } - } - } - } - } - } - } - } - declarations { - alias { - name: "IF" - target { - simple_member_access { - field: "F" - object { - identifier { - name: "I" - } - } - } - } - } - } - declarations { - alias { - name: "IM" - target { - simple_member_access { - field: "M" - object { - identifier { - name: "I" - } - } - } - } - } - } - declarations { - alias { - name: "AIF" - target { - compound_member_access { - object { - identifier { - name: "A" - } - } - path { - identifier { - name: "IF" - } - } - } - } - } - } - declarations { - alias { - name: "AIM" - target { - compound_member_access { - object { - identifier { - name: "A" - } - } - path { - identifier { - name: "IM" - } - } - } - } - } - } - declarations { - alias { - name: "AG" - target { - simple_member_access { - field: "G" - object { - identifier { - name: "A" - } - } - } - } - } - } - declarations { - alias { - name: "i32IF" - target { - compound_member_access { - object { - int_type_literal { - } - } - path { - identifier { - name: "IF" - } - } - } - } - } - } - declarations { - alias { - name: "i32IM" - target { - compound_member_access { - object { - int_type_literal { - } - } - path { - identifier { - name: "IM" - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "A" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "n" - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - statements { - if_statement { - condition { - operator { - op: Not - arguments { - operator { - op: Eq - arguments { - call { - function { - compound_member_access { - object { - identifier { - name: "A" - } - } - path { - identifier { - name: "IF" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - arguments { - int_literal { - value: 1 - } - } - } - } - } - } - then_block { - statements { - return_statement { - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - statements { - if_statement { - condition { - operator { - op: Not - arguments { - operator { - op: Eq - arguments { - call { - function { - compound_member_access { - object { - identifier { - name: "a" - } - } - path { - identifier { - name: "IF" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - arguments { - int_literal { - value: 1 - } - } - } - } - } - } - then_block { - statements { - return_statement { - expression { - int_literal { - value: 2 - } - } - } - } - } - } - } - statements { - if_statement { - condition { - operator { - op: Not - arguments { - operator { - op: Eq - arguments { - call { - function { - compound_member_access { - object { - identifier { - name: "a" - } - } - path { - identifier { - name: "IM" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - arguments { - int_literal { - value: 2 - } - } - } - } - } - } - then_block { - statements { - return_statement { - expression { - int_literal { - value: 3 - } - } - } - } - } - } - } - statements { - if_statement { - condition { - operator { - op: Not - arguments { - operator { - op: Eq - arguments { - call { - function { - compound_member_access { - object { - identifier { - name: "a" - } - } - path { - compound_member_access { - object { - identifier { - name: "A" - } - } - path { - identifier { - name: "IM" - } - } - } - } - } - } - argument { - tuple_literal { - } - } - } - } - arguments { - int_literal { - value: 2 - } - } - } - } - } - } - then_block { - statements { - return_statement { - expression { - int_literal { - value: 4 - } - } - } - } - } - } - } - statements { - if_statement { - condition { - operator { - op: Not - arguments { - operator { - op: Eq - arguments { - call { - function { - identifier { - name: "AIF" - } - } - argument { - tuple_literal { - } - } - } - } - arguments { - int_literal { - value: 1 - } - } - } - } - } - } - then_block { - statements { - return_statement { - expression { - int_literal { - value: 5 - } - } - } - } - } - } - } - statements { - if_statement { - condition { - operator { - op: Not - arguments { - operator { - op: Eq - arguments { - call { - function { - compound_member_access { - object { - identifier { - name: "a" - } - } - path { - identifier { - name: "AIM" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - arguments { - int_literal { - value: 2 - } - } - } - } - } - } - then_block { - statements { - return_statement { - expression { - int_literal { - value: 6 - } - } - } - } - } - } - } - statements { - if_statement { - condition { - operator { - op: Not - arguments { - operator { - op: Eq - arguments { - call { - function { - compound_member_access { - object { - identifier { - name: "a" - } - } - path { - identifier { - name: "AG" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - arguments { - int_literal { - value: 3 - } - } - } - } - } - } - then_block { - statements { - return_statement { - expression { - int_literal { - value: 7 - } - } - } - } - } - } - } - statements { - if_statement { - condition { - operator { - op: Not - arguments { - operator { - op: Eq - arguments { - call { - function { - compound_member_access { - object { - int_type_literal { - } - } - path { - identifier { - name: "IF" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - arguments { - int_literal { - value: 4 - } - } - } - } - } - } - then_block { - statements { - return_statement { - expression { - int_literal { - value: 8 - } - } - } - } - } - } - } - statements { - if_statement { - condition { - operator { - op: Not - arguments { - operator { - op: Eq - arguments { - call { - function { - compound_member_access { - object { - int_literal { - value: 0 - } - } - path { - identifier { - name: "IF" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - arguments { - int_literal { - value: 4 - } - } - } - } - } - } - then_block { - statements { - return_statement { - expression { - int_literal { - value: 9 - } - } - } - } - } - } - } - statements { - if_statement { - condition { - operator { - op: Not - arguments { - operator { - op: Eq - arguments { - call { - function { - compound_member_access { - object { - int_literal { - value: 0 - } - } - path { - identifier { - name: "IM" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - arguments { - int_literal { - value: 5 - } - } - } - } - } - } - then_block { - statements { - return_statement { - expression { - int_literal { - value: 10 - } - } - } - } - } - } - } - statements { - if_statement { - condition { - operator { - op: Not - arguments { - operator { - op: Eq - arguments { - call { - function { - compound_member_access { - object { - int_literal { - value: 0 - } - } - path { - compound_member_access { - object { - int_type_literal { - } - } - path { - identifier { - name: "IM" - } - } - } - } - } - } - argument { - tuple_literal { - } - } - } - } - arguments { - int_literal { - value: 5 - } - } - } - } - } - } - then_block { - statements { - return_statement { - expression { - int_literal { - value: 11 - } - } - } - } - } - } - } - statements { - if_statement { - condition { - operator { - op: Not - arguments { - operator { - op: Eq - arguments { - call { - function { - identifier { - name: "i32IF" - } - } - argument { - tuple_literal { - } - } - } - } - arguments { - int_literal { - value: 4 - } - } - } - } - } - } - then_block { - statements { - return_statement { - expression { - int_literal { - value: 12 - } - } - } - } - } - } - } - statements { - if_statement { - condition { - operator { - op: Not - arguments { - operator { - op: Eq - arguments { - call { - function { - compound_member_access { - object { - int_literal { - value: 0 - } - } - path { - identifier { - name: "i32IM" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - arguments { - int_literal { - value: 5 - } - } - } - } - } - } - then_block { - statements { - return_statement { - expression { - int_literal { - value: 13 - } - } - } - } - } - } - } - statements { - return_statement { - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/6c25c16bd50745570b78bee439871f5d6a0ca621 b/explorer/fuzzing/fuzzer_corpus/6c25c16bd50745570b78bee439871f5d6a0ca621 deleted file mode 100644 index 17110ca438966..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/6c25c16bd50745570b78bee439871f5d6a0ca621 +++ /dev/null @@ -1,283 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "Point" - members { - function { - name: "Origin" - param_pattern { - fields { - binding_pattern { - name: "zero" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - call { - function { - identifier { - name: "Self" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - identifier { - name: "zero" - } - } - } - fields { - name: "y" - expression { - identifier { - name: "zero" - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "GetX" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Self" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - return_statement { - expression { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - } - } - } - } - } - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - type_params { - fields { - generic_binding { - name: "T" - type { - type_type_literal { - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - call { - function { - simple_member_access { - field: "Origin" - object { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - argument { - tuple_literal { - fields { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "GetX" - object { - identifier { - name: "p" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/6cda920c7329398b3d5b3766b83c8deed3dc835c b/explorer/fuzzing/fuzzer_corpus/6cda920c7329398b3d5b3766b83c8deed3dc835c deleted file mode 100644 index fbeb1212846c7..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/6cda920c7329398b3d5b3766b83c8deed3dc835c +++ /dev/null @@ -1,305 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "Wrap" - members { - variable { - binding { - name: "v" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - type_params { - fields { - generic_binding { - name: "T" - type { - type_type_literal { - } - } - } - } - } - } - } - declarations { - function { - name: "MakeWrap" - deduced_parameters { - name: "T" - type { - type_type_literal { - } - } - } - param_pattern { - fields { - binding_pattern { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - call { - function { - identifier { - name: "Wrap" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "v" - expression { - identifier { - name: "x" - } - } - } - } - } - } - } - } - } - } - declarations { - impl { - kind: InternalImpl - impl_type { - call { - function { - identifier { - name: "Wrap" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - interface { - call { - function { - identifier { - name: "ImplicitAs" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - members { - function { - name: "Convert" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - return_statement { - expression { - simple_member_access { - field: "v" - object { - identifier { - name: "self" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "n" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - init { - int_literal { - value: 1 - } - } - } - } - statements { - continuation { - name: "k" - body { - statements { - assign { - lhs { - identifier { - name: "n" - } - } - rhs { - operator { - op: Add - arguments { - identifier { - name: "n" - } - } - arguments { - int_literal { - value: 1 - } - } - } - } - } - } - } - } - } - statements { - assign { - lhs { - identifier { - name: "n" - } - } - rhs { - int_literal { - value: 2 - } - } - } - } - statements { - run { - argument { - call { - function { - identifier { - name: "MakeWrap" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "k" - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - identifier { - name: "n" - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/7157552a4bd3e30351e21e9a9139d8379ef34eb0 b/explorer/fuzzing/fuzzer_corpus/7157552a4bd3e30351e21e9a9139d8379ef34eb0 deleted file mode 100644 index 5f26e3fe22212..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/7157552a4bd3e30351e21e9a9139d8379ef34eb0 +++ /dev/null @@ -1,418 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Vector" - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - function { - name: "ScaleGeneric" - deduced_parameters { - name: "T" - type { - identifier { - name: "Vector" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "s" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "Scale" - object { - identifier { - name: "a" - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "s" - } - } - } - } - } - } - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Point" - } - } - interface { - identifier { - name: "Vector" - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 3 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "ScaleGeneric" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "a" - } - } - fields { - int_literal { - value: 2 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Sub - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "b" - } - } - } - } - arguments { - int_literal { - value: 6 - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/761eaa907a94fe001f6b5e31159f0b6c4ef171d8 b/explorer/fuzzing/fuzzer_corpus/761eaa907a94fe001f6b5e31159f0b6c4ef171d8 deleted file mode 100644 index d830efabf84b0..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/761eaa907a94fe001f6b5e31159f0b6c4ef171d8 +++ /dev/null @@ -1,669 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Vector" - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - declarations { - impl { - kind: ExternalImpl - impl_type { - identifier { - name: "Point" - } - } - interface { - identifier { - name: "Vector" - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "AddAndScaleGeneric" - deduced_parameters { - name: "T" - type { - identifier { - name: "Vector" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "s" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "m" - type { - auto_pattern { - } - } - } - } - init { - simple_member_access { - field: "Add" - object { - identifier { - name: "a" - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "n" - type { - auto_pattern { - } - } - } - } - init { - simple_member_access { - field: "Scale" - object { - call { - function { - identifier { - name: "m" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - call { - function { - identifier { - name: "n" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "s" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 1 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 4 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 2 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 3 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "AddAndScaleGeneric" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "a" - } - } - fields { - identifier { - name: "b" - } - } - fields { - int_literal { - value: 5 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Sub - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "p" - } - } - } - } - arguments { - int_literal { - value: 15 - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/781ecc36990e2394a0c6823855c583aae691bc78 b/explorer/fuzzing/fuzzer_corpus/781ecc36990e2394a0c6823855c583aae691bc78 deleted file mode 100644 index 723fdc5b7adc6..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/781ecc36990e2394a0c6823855c583aae691bc78 +++ /dev/null @@ -1,151 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "A" - members { - variable { - binding { - name: "n" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - declarations { - impl { - kind: InternalImpl - impl_type { - int_type_literal { - } - } - interface { - call { - function { - identifier { - name: "ImplicitAs" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "A" - } - } - } - } - } - } - members { - function { - name: "Convert" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "A" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "n" - expression { - identifier { - name: "self" - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - variable { - binding { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "A" - } - } - } - } - } - initializer { - int_literal { - value: 5 - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - simple_member_access { - field: "n" - object { - identifier { - name: "a" - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/8656cefeac8b03c9c7f2073d4811a04d69b83ec8 b/explorer/fuzzing/fuzzer_corpus/8656cefeac8b03c9c7f2073d4811a04d69b83ec8 deleted file mode 100644 index d766ccd38067b..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/8656cefeac8b03c9c7f2073d4811a04d69b83ec8 +++ /dev/null @@ -1,402 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "IntLike" - members { - function { - name: "Convert" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - impl { - kind: InternalImpl - impl_type { - int_type_literal { - } - } - interface { - identifier { - name: "IntLike" - } - } - members { - function { - name: "Convert" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - identifier { - name: "self" - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "add" - deduced_parameters { - name: "T" - type { - identifier { - name: "IntLike" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "x" - type { - expression_pattern { - expression { - struct_type_literal { - fields { - name: "a" - expression { - identifier { - name: "T" - } - } - } - fields { - name: "b" - expression { - tuple_literal { - fields { - struct_type_literal { - fields { - name: "m" - expression { - int_type_literal { - } - } - } - fields { - name: "n" - expression { - identifier { - name: "T" - } - } - } - } - } - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - operator { - op: Add - arguments { - operator { - op: Add - arguments { - operator { - op: Add - arguments { - operator { - op: Mul - arguments { - int_literal { - value: 1000 - } - } - arguments { - call { - function { - simple_member_access { - field: "Convert" - object { - simple_member_access { - field: "a" - object { - identifier { - name: "x" - } - } - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - arguments { - operator { - op: Mul - arguments { - int_literal { - value: 100 - } - } - arguments { - simple_member_access { - field: "m" - object { - index { - object { - simple_member_access { - field: "b" - object { - identifier { - name: "x" - } - } - } - } - offset { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - } - } - arguments { - operator { - op: Mul - arguments { - int_literal { - value: 10 - } - } - arguments { - call { - function { - simple_member_access { - field: "Convert" - object { - simple_member_access { - field: "n" - object { - index { - object { - simple_member_access { - field: "b" - object { - identifier { - name: "x" - } - } - } - } - offset { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - arguments { - index { - object { - simple_member_access { - field: "b" - object { - identifier { - name: "x" - } - } - } - } - offset { - int_literal { - value: 1 - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - identifier { - name: "add" - } - } - argument { - tuple_literal { - fields { - struct_literal { - fields { - name: "b" - expression { - tuple_literal { - fields { - struct_literal { - fields { - name: "n" - expression { - int_literal { - value: 1 - } - } - } - fields { - name: "m" - expression { - int_literal { - value: 2 - } - } - } - } - } - fields { - int_literal { - value: 3 - } - } - } - } - } - fields { - name: "a" - expression { - int_literal { - value: 4 - } - } - } - } - } - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/8c090ae94a3fdb5c70d49a69b7f6d0ac1cec7fdf b/explorer/fuzzing/fuzzer_corpus/8c090ae94a3fdb5c70d49a69b7f6d0ac1cec7fdf deleted file mode 100644 index c66094f470ab8..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/8c090ae94a3fdb5c70d49a69b7f6d0ac1cec7fdf +++ /dev/null @@ -1,694 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Vector" - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - type_params { - fields { - generic_binding { - name: "T" - type { - type_type_literal { - } - } - } - } - } - } - } - declarations { - impl { - kind: ExternalImpl - impl_type { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - interface { - identifier { - name: "Vector" - } - } - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 0 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "AddAndScaleGeneric" - deduced_parameters { - name: "T" - type { - identifier { - name: "Vector" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "s" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "Scale" - object { - call { - function { - simple_member_access { - field: "Add" - object { - identifier { - name: "a" - } - } - } - } - argument { - tuple_literal { - fields { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "T" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "s" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 2 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "AddAndScaleGeneric" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "a" - } - } - fields { - int_literal { - value: 5 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Sub - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "p" - } - } - } - } - arguments { - int_literal { - value: 10 - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/910b0bf2a2d9eae7d81ff57e0f451282e869d1ed b/explorer/fuzzing/fuzzer_corpus/910b0bf2a2d9eae7d81ff57e0f451282e869d1ed deleted file mode 100644 index 4a3aaf41ae992..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/910b0bf2a2d9eae7d81ff57e0f451282e869d1ed +++ /dev/null @@ -1,244 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "A" - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Self" - } - } - interface { - call { - function { - identifier { - name: "ImplicitAs" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - members { - function { - name: "Convert" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - simple_member_access { - field: "n" - object { - identifier { - name: "self" - } - } - } - } - } - } - } - } - } - } - } - members { - variable { - binding { - name: "n" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "A" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "n" - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "A" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "n" - expression { - int_literal { - value: 2 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - tuple_pattern { - fields { - binding_pattern { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - fields { - var_pattern { - pattern { - binding_pattern { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - tuple_literal { - fields { - identifier { - name: "a" - } - } - fields { - identifier { - name: "b" - } - } - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Add - arguments { - identifier { - name: "x" - } - } - arguments { - identifier { - name: "y" - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/91e7c6b8d14f7d5a82076f29ac5cc135b27e1829 b/explorer/fuzzing/fuzzer_corpus/91e7c6b8d14f7d5a82076f29ac5cc135b27e1829 deleted file mode 100644 index 47df46a0dfce3..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/91e7c6b8d14f7d5a82076f29ac5cc135b27e1829 +++ /dev/null @@ -1,383 +0,0 @@ -compilation_unit { - package_statement { - package_name: "Foo" - } - is_api: true - declarations { - interface { - name: "A" - members { - function { - name: "F" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "o" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "X" - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Self" - } - } - interface { - identifier { - name: "A" - } - } - members { - function { - name: "F" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "o" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "n" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "n" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "n" - object { - identifier { - name: "o" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - variable { - binding { - name: "n" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "F" - deduced_parameters { - name: "T" - type { - identifier { - name: "A" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "w" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - compound_member_access { - object { - identifier { - name: "v" - } - } - path { - compound_member_access { - object { - identifier { - name: "T" - } - } - path { - simple_member_access { - field: "F" - object { - identifier { - name: "A" - } - } - } - } - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "w" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - identifier { - name: "X" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "n" - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "w" - type { - expression_pattern { - expression { - identifier { - name: "X" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "n" - expression { - int_literal { - value: 2 - } - } - } - } - } - } - } - statements { - return_statement { - expression { - simple_member_access { - field: "n" - object { - call { - function { - identifier { - name: "F" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "v" - } - } - fields { - identifier { - name: "w" - } - } - } - } - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/93520a24f7e183a277cd67f30907e0c979969e00 b/explorer/fuzzing/fuzzer_corpus/93520a24f7e183a277cd67f30907e0c979969e00 deleted file mode 100644 index f48c717b8c71f..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/93520a24f7e183a277cd67f30907e0c979969e00 +++ /dev/null @@ -1,645 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Vector" - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Self" - } - } - interface { - identifier { - name: "Vector" - } - } - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 0 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "AddAndScaleGeneric" - deduced_parameters { - name: "T" - type { - identifier { - name: "Vector" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "s" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "Scale" - object { - call { - function { - simple_member_access { - field: "Add" - object { - identifier { - name: "a" - } - } - } - } - argument { - tuple_literal { - fields { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "T" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "s" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 2 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "AddAndScaleGeneric" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "a" - } - } - fields { - int_literal { - value: 5 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Sub - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "p" - } - } - } - } - arguments { - int_literal { - value: 10 - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/981655702b85acf10978cdb81df86b9399788092 b/explorer/fuzzing/fuzzer_corpus/981655702b85acf10978cdb81df86b9399788092 deleted file mode 100644 index 6bc47fdce33a2..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/981655702b85acf10978cdb81df86b9399788092 +++ /dev/null @@ -1,245 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "A" - } - } - declarations { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "A" - } - } - interface { - call { - function { - identifier { - name: "ImplicitAs" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - members { - function { - name: "Convert" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "A" - } - } - } - } - } - } - init { - struct_type_literal { - } - } - } - } - statements { - match { - expression { - tuple_literal { - fields { - identifier { - name: "a" - } - } - fields { - identifier { - name: "a" - } - } - } - } - clauses { - pattern { - tuple_pattern { - fields { - expression_pattern { - expression { - int_literal { - value: 0 - } - } - } - } - fields { - binding_pattern { - name: "n" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - statement { - return_statement { - expression { - int_literal { - value: 1 - } - } - } - } - } - clauses { - pattern { - tuple_pattern { - fields { - binding_pattern { - name: "n" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - fields { - expression_pattern { - expression { - int_literal { - value: 0 - } - } - } - } - } - } - statement { - return_statement { - expression { - int_literal { - value: 1 - } - } - } - } - } - clauses { - pattern { - expression_pattern { - expression { - tuple_literal { - fields { - int_literal { - value: 1 - } - } - fields { - int_literal { - value: 1 - } - } - } - } - } - } - statement { - return_statement { - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - statements { - return_statement { - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/9f1a867accead08d789b8f7d6b3b7303a643bbc2 b/explorer/fuzzing/fuzzer_corpus/9f1a867accead08d789b8f7d6b3b7303a643bbc2 deleted file mode 100644 index ecf353ec96c7d..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/9f1a867accead08d789b8f7d6b3b7303a643bbc2 +++ /dev/null @@ -1,805 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Number" - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "other" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - type_params { - fields { - generic_binding { - name: "T" - type { - identifier { - name: "Number" - } - } - } - } - } - } - } - declarations { - impl { - kind: ExternalImpl - impl_type { - int_type_literal { - } - } - interface { - identifier { - name: "Number" - } - } - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "other" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - operator { - op: Add - arguments { - identifier { - name: "self" - } - } - arguments { - identifier { - name: "other" - } - } - } - } - } - } - } - } - } - } - } - declarations { - impl { - kind: ExternalImpl - impl_type { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "U" - } - } - } - } - } - } - interface { - identifier { - name: "Number" - } - } - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "U" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - fields { - name: "y" - expression { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "U" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "other" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - call { - function { - simple_member_access { - field: "Add" - object { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - } - } - argument { - tuple_literal { - fields { - simple_member_access { - field: "x" - object { - identifier { - name: "other" - } - } - } - } - } - } - } - } - } - fields { - name: "y" - expression { - call { - function { - simple_member_access { - field: "Add" - object { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - } - } - argument { - tuple_literal { - fields { - simple_member_access { - field: "y" - object { - identifier { - name: "other" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Sum" - deduced_parameters { - name: "E" - type { - identifier { - name: "Number" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "E" - } - } - } - } - } - } - fields { - binding_pattern { - name: "y" - type { - expression_pattern { - expression { - identifier { - name: "E" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "E" - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "total" - type { - expression_pattern { - expression { - identifier { - name: "E" - } - } - } - } - } - } - init { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "E" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - statements { - assign { - lhs { - identifier { - name: "total" - } - } - rhs { - call { - function { - simple_member_access { - field: "Add" - object { - identifier { - name: "total" - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "x" - } - } - } - } - } - } - } - } - statements { - assign { - lhs { - identifier { - name: "total" - } - } - rhs { - call { - function { - simple_member_access { - field: "Add" - object { - identifier { - name: "total" - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "y" - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - identifier { - name: "total" - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 1 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 2 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "q" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 4 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 3 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "r" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "Sum" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "p" - } - } - fields { - identifier { - name: "q" - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Sub - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "r" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "r" - } - } - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/ac929314f700519e9c008f6e2817910c067c949b b/explorer/fuzzing/fuzzer_corpus/ac929314f700519e9c008f6e2817910c067c949b deleted file mode 100644 index fa58c54561db5..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/ac929314f700519e9c008f6e2817910c067c949b +++ /dev/null @@ -1,174 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - choice { - name: "A" - alternatives { - name: "Value" - signature { - fields { - int_type_literal { - } - } - } - } - } - } - declarations { - impl { - kind: InternalImpl - impl_type { - int_type_literal { - } - } - interface { - call { - function { - identifier { - name: "ImplicitAs" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "A" - } - } - } - } - } - } - members { - function { - name: "Convert" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "A" - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "Value" - object { - identifier { - name: "A" - } - } - } - } - argument { - tuple_literal { - fields { - operator { - op: Add - arguments { - identifier { - name: "self" - } - } - arguments { - int_literal { - value: 1 - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - alternative_pattern { - choice_type { - identifier { - name: "A" - } - } - alternative_name: "Value" - arguments { - fields { - binding_pattern { - name: "n" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - init { - int_literal { - value: 2 - } - } - } - } - statements { - return_statement { - expression { - identifier { - name: "n" - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/b140b427aeef91089568f3b775bd4683bfad5c0e b/explorer/fuzzing/fuzzer_corpus/b140b427aeef91089568f3b775bd4683bfad5c0e deleted file mode 100644 index 355aa783aac72..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/b140b427aeef91089568f3b775bd4683bfad5c0e +++ /dev/null @@ -1,324 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "B" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - function { - name: "GetSetX" - self_pattern { - addr_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - operator { - op: Ptr - arguments { - identifier { - name: "Self" - } - } - } - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "oldX" - type { - auto_pattern { - } - } - } - } - init { - simple_member_access { - field: "x" - object { - operator { - op: Deref - arguments { - identifier { - name: "self" - } - } - } - } - } - } - } - } - statements { - assign { - lhs { - simple_member_access { - field: "x" - object { - operator { - op: Deref - arguments { - identifier { - name: "self" - } - } - } - } - } - } - rhs { - identifier { - name: "x" - } - } - } - } - statements { - return_statement { - expression { - identifier { - name: "oldX" - } - } - } - } - } - } - } - } - } - declarations { - class_declaration { - name: "A" - members { - variable { - binding { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "B" - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "B" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "A" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "b" - expression { - identifier { - name: "b" - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "x" - type { - auto_pattern { - } - } - } - } - init { - call { - function { - simple_member_access { - field: "GetSetX" - object { - simple_member_access { - field: "b" - object { - identifier { - name: "a" - } - } - } - } - } - } - argument { - tuple_literal { - fields { - int_literal { - value: 42 - } - } - } - } - } - } - } - } - statements { - if_statement { - condition { - operator { - op: Eq - arguments { - simple_member_access { - field: "x" - object { - simple_member_access { - field: "b" - object { - identifier { - name: "a" - } - } - } - } - } - } - arguments { - int_literal { - value: 42 - } - } - } - } - then_block { - statements { - return_statement { - expression { - identifier { - name: "x" - } - } - } - } - } - } - } - statements { - return_statement { - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/b1f2cfe33f8d50f38ce8addd62b76519bd589d9e b/explorer/fuzzing/fuzzer_corpus/b1f2cfe33f8d50f38ce8addd62b76519bd589d9e deleted file mode 100644 index eed7a81f8534a..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/b1f2cfe33f8d50f38ce8addd62b76519bd589d9e +++ /dev/null @@ -1,82 +0,0 @@ -compilation_unit { - package_statement { - package_name: "Foo" - } - is_api: true - declarations { - function { - name: "F" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Omitted - } - body { - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - expression_statement { - expression { - call { - function { - compound_member_access { - object { - int_literal { - value: 42 - } - } - path { - identifier { - name: "F" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - statements { - return_statement { - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/b8e05ecd5da75a6af34295d2396d27fec1cfd4d5 b/explorer/fuzzing/fuzzer_corpus/b8e05ecd5da75a6af34295d2396d27fec1cfd4d5 deleted file mode 100644 index 61cffd2da7cc2..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/b8e05ecd5da75a6af34295d2396d27fec1cfd4d5 +++ /dev/null @@ -1,200 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "Point" - members { - function { - name: "Origin" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 0 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "GetX" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - } - } - } - } - } - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - call { - function { - simple_member_access { - field: "Origin" - object { - identifier { - name: "Point" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "GetX" - object { - identifier { - name: "p" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/be2a3f66b52634d15b9e34c0ed93ce8ffebcd527 b/explorer/fuzzing/fuzzer_corpus/be2a3f66b52634d15b9e34c0ed93ce8ffebcd527 deleted file mode 100644 index 832f49ae478ad..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/be2a3f66b52634d15b9e34c0ed93ce8ffebcd527 +++ /dev/null @@ -1,228 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "Point" - members { - function { - name: "Origin" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 0 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "GetX" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - } - } - } - } - } - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - call { - function { - simple_member_access { - field: "Origin" - object { - identifier { - name: "Point" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "f" - type { - expression_pattern { - expression { - function_type { - return_type { - int_type_literal { - } - } - parameter { - } - } - } - } - } - } - } - init { - simple_member_access { - field: "GetX" - object { - identifier { - name: "p" - } - } - } - } - } - } - statements { - return_statement { - expression { - call { - function { - identifier { - name: "f" - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/bfa6ce9868e4fb4c6ddbc3f922c010261084f3a5 b/explorer/fuzzing/fuzzer_corpus/bfa6ce9868e4fb4c6ddbc3f922c010261084f3a5 deleted file mode 100644 index dcaf8731d60b6..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/bfa6ce9868e4fb4c6ddbc3f922c010261084f3a5 +++ /dev/null @@ -1,495 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Number" - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "other" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - function { - name: "Origin" - param_pattern { - } - return_term { - kind: Expression - type { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "T" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - fields { - name: "y" - expression { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "T" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } - } - } - } - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - type_params { - fields { - generic_binding { - name: "T" - type { - identifier { - name: "Number" - } - } - } - } - } - } - } - declarations { - impl { - kind: ExternalImpl - impl_type { - int_type_literal { - } - } - interface { - identifier { - name: "Number" - } - } - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "other" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - operator { - op: Add - arguments { - identifier { - name: "self" - } - } - arguments { - identifier { - name: "other" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "SumXY" - deduced_parameters { - name: "U" - type { - identifier { - name: "Number" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "U" - } - } - } - } - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "U" - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "Add" - object { - simple_member_access { - field: "x" - object { - call { - function { - simple_member_access { - field: "Origin" - object { - identifier { - name: "p" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - argument { - tuple_literal { - fields { - simple_member_access { - field: "y" - object { - identifier { - name: "p" - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 0 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - statements { - return_statement { - expression { - call { - function { - identifier { - name: "SumXY" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "p" - } - } - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/c2646dc4add2384ca4c733a9a706b218397cc1c8 b/explorer/fuzzing/fuzzer_corpus/c2646dc4add2384ca4c733a9a706b218397cc1c8 deleted file mode 100644 index edb0569e5e540..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/c2646dc4add2384ca4c733a9a706b218397cc1c8 +++ /dev/null @@ -1,174 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "A" - members { - variable { - binding { - name: "n" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - declarations { - impl { - kind: InternalImpl - impl_type { - int_type_literal { - } - } - interface { - call { - function { - identifier { - name: "ImplicitAs" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "A" - } - } - } - } - } - } - members { - function { - name: "Convert" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "A" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "n" - expression { - identifier { - name: "self" - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "A" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "n" - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - statements { - assign { - lhs { - identifier { - name: "a" - } - } - rhs { - int_literal { - value: 1 - } - } - } - } - statements { - return_statement { - expression { - simple_member_access { - field: "n" - object { - identifier { - name: "a" - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/c578992c249bcfb9ce98c775fee12bba7d7af36d b/explorer/fuzzing/fuzzer_corpus/c578992c249bcfb9ce98c775fee12bba7d7af36d deleted file mode 100644 index b0b503b5e4c20..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/c578992c249bcfb9ce98c775fee12bba7d7af36d +++ /dev/null @@ -1,623 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Vector" - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Point" - } - } - interface { - identifier { - name: "Vector" - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "AddAndScaleGeneric" - deduced_parameters { - name: "T" - type { - identifier { - name: "Vector" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "s" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "m" - type { - auto_pattern { - } - } - } - } - init { - simple_member_access { - field: "Add" - object { - identifier { - name: "a" - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "n" - type { - auto_pattern { - } - } - } - } - init { - simple_member_access { - field: "Scale" - object { - call { - function { - identifier { - name: "m" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - call { - function { - identifier { - name: "n" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "s" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 0 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 2 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 3 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "AddAndScaleGeneric" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "a" - } - } - fields { - identifier { - name: "b" - } - } - fields { - int_literal { - value: 3 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Sub - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "p" - } - } - } - } - arguments { - int_literal { - value: 6 - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/c593c6692ed2ef06d7d2749add94d4ebd91dbba7 b/explorer/fuzzing/fuzzer_corpus/c593c6692ed2ef06d7d2749add94d4ebd91dbba7 deleted file mode 100644 index a2a9d7ff80c97..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/c593c6692ed2ef06d7d2749add94d4ebd91dbba7 +++ /dev/null @@ -1,505 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "AddWith" - members { - function { - name: "Op" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - declarations { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Point" - } - } - interface { - call { - function { - identifier { - name: "AddWith" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "Self" - } - } - } - } - } - } - members { - function { - name: "Op" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "DoAddGeneric" - deduced_parameters { - name: "T" - type { - type_type_literal { - } - } - } - deduced_parameters { - name: "U" - type { - call { - function { - identifier { - name: "AddWith" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "U" - } - } - } - } - } - } - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "U" - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "Op" - object { - identifier { - name: "a" - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 2 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 4 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 2 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "DoAddGeneric" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "a" - } - } - fields { - identifier { - name: "b" - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Sub - arguments { - operator { - op: Sub - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "p" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "p" - } - } - } - } - } - } - arguments { - int_literal { - value: 3 - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/c769fdc8c81040b10176d937e9fea824e17b065f b/explorer/fuzzing/fuzzer_corpus/c769fdc8c81040b10176d937e9fea824e17b065f deleted file mode 100644 index bae2f4fa93323..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/c769fdc8c81040b10176d937e9fea824e17b065f +++ /dev/null @@ -1,679 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Vector" - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - identifier { - name: "Scalar" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Point" - } - } - interface { - call { - function { - identifier { - name: "Vector" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 0 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "AddAndScaleGeneric" - deduced_parameters { - name: "T" - type { - type_type_literal { - } - } - } - deduced_parameters { - name: "U" - type { - call { - function { - identifier { - name: "Vector" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "U" - } - } - } - } - } - } - fields { - binding_pattern { - name: "s" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "U" - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "Scale" - object { - call { - function { - simple_member_access { - field: "Add" - object { - identifier { - name: "a" - } - } - } - } - argument { - tuple_literal { - fields { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "U" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "s" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 2 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "AddAndScaleGeneric" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "a" - } - } - fields { - int_literal { - value: 5 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Sub - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "p" - } - } - } - } - arguments { - int_literal { - value: 10 - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/caf0048f803af5a515f0ebff6140d6e2ee52e8fb b/explorer/fuzzing/fuzzer_corpus/caf0048f803af5a515f0ebff6140d6e2ee52e8fb deleted file mode 100644 index b5a7907cc4844..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/caf0048f803af5a515f0ebff6140d6e2ee52e8fb +++ /dev/null @@ -1,768 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "I" - members { - function { - name: "F" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "t" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "o" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "X" - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Self" - } - } - interface { - call { - function { - identifier { - name: "I" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "U" - } - } - } - } - } - } - members { - function { - name: "F" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "u" - type { - expression_pattern { - expression { - identifier { - name: "U" - } - } - } - } - } - } - fields { - binding_pattern { - name: "o" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "m" - expression { - identifier { - name: "u" - } - } - } - fields { - name: "n" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "n" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "n" - object { - identifier { - name: "o" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - variable { - binding { - name: "m" - type { - expression_pattern { - expression { - identifier { - name: "U" - } - } - } - } - } - } - } - members { - variable { - binding { - name: "n" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - type_params { - fields { - generic_binding { - name: "U" - type { - type_type_literal { - } - } - } - } - } - } - } - declarations { - function { - name: "Run" - deduced_parameters { - name: "V" - type { - type_type_literal { - } - } - } - param_pattern { - fields { - binding_pattern { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "V" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - tuple_literal { - fields { - identifier { - name: "V" - } - } - fields { - identifier { - name: "V" - } - } - fields { - int_type_literal { - } - } - fields { - int_type_literal { - } - } - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "X" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "V" - } - } - } - } - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "m" - expression { - identifier { - name: "x" - } - } - } - fields { - name: "n" - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "w" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "X" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "V" - } - } - } - } - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "m" - expression { - identifier { - name: "x" - } - } - } - fields { - name: "n" - expression { - int_literal { - value: 2 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "call" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "X" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "V" - } - } - } - } - } - } - } - } - } - } - init { - call { - function { - compound_member_access { - object { - identifier { - name: "v" - } - } - path { - compound_member_access { - object { - call { - function { - identifier { - name: "X" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "V" - } - } - } - } - } - } - path { - simple_member_access { - field: "F" - object { - call { - function { - identifier { - name: "I" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "V" - } - } - } - } - } - } - } - } - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "x" - } - } - fields { - identifier { - name: "w" - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - tuple_literal { - fields { - compound_member_access { - object { - identifier { - name: "call" - } - } - path { - simple_member_access { - field: "m" - object { - call { - function { - identifier { - name: "X" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "V" - } - } - } - } - } - } - } - } - } - } - fields { - simple_member_access { - field: "m" - object { - identifier { - name: "call" - } - } - } - } - fields { - compound_member_access { - object { - identifier { - name: "call" - } - } - path { - simple_member_access { - field: "n" - object { - call { - function { - identifier { - name: "X" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "V" - } - } - } - } - } - } - } - } - } - } - fields { - simple_member_access { - field: "n" - object { - identifier { - name: "call" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - tuple_pattern { - fields { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - fields { - binding_pattern { - name: "c" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - fields { - binding_pattern { - name: "d" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "Run" - } - } - argument { - tuple_literal { - fields { - int_literal { - value: 1 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Add - arguments { - operator { - op: Add - arguments { - operator { - op: Add - arguments { - operator { - op: Mul - arguments { - identifier { - name: "a" - } - } - arguments { - int_literal { - value: 1000 - } - } - } - } - arguments { - operator { - op: Mul - arguments { - identifier { - name: "b" - } - } - arguments { - int_literal { - value: 100 - } - } - } - } - } - } - arguments { - operator { - op: Mul - arguments { - identifier { - name: "c" - } - } - arguments { - int_literal { - value: 10 - } - } - } - } - } - } - arguments { - identifier { - name: "d" - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/cd181298508a398cacb7dd4bd4eb75c14a8dd3e0 b/explorer/fuzzing/fuzzer_corpus/cd181298508a398cacb7dd4bd4eb75c14a8dd3e0 deleted file mode 100644 index 6311682b1f226..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/cd181298508a398cacb7dd4bd4eb75c14a8dd3e0 +++ /dev/null @@ -1,374 +0,0 @@ -compilation_unit { - package_statement { - package_name: "Foo" - } - is_api: true - declarations { - interface { - name: "A" - members { - function { - name: "F" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "o" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "X" - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Self" - } - } - interface { - identifier { - name: "A" - } - } - members { - function { - name: "F" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "o" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "n" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "n" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "n" - object { - identifier { - name: "o" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - variable { - binding { - name: "n" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "F" - deduced_parameters { - name: "T" - type { - identifier { - name: "A" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "w" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - compound_member_access { - object { - identifier { - name: "v" - } - } - path { - simple_member_access { - field: "F" - object { - identifier { - name: "T" - } - } - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "w" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - identifier { - name: "X" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "n" - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "w" - type { - expression_pattern { - expression { - identifier { - name: "X" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "n" - expression { - int_literal { - value: 2 - } - } - } - } - } - } - } - statements { - return_statement { - expression { - simple_member_access { - field: "n" - object { - call { - function { - identifier { - name: "F" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "v" - } - } - fields { - identifier { - name: "w" - } - } - } - } - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/ce85fb106849dde89ccc11e6ff799faa8c74af07 b/explorer/fuzzing/fuzzer_corpus/ce85fb106849dde89ccc11e6ff799faa8c74af07 deleted file mode 100644 index 2ff8c6126c079..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/ce85fb106849dde89ccc11e6ff799faa8c74af07 +++ /dev/null @@ -1,257 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "Point" - members { - function { - name: "Origin" - param_pattern { - fields { - binding_pattern { - name: "zero" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - identifier { - name: "zero" - } - } - } - fields { - name: "y" - expression { - identifier { - name: "zero" - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "GetX" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - return_statement { - expression { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - } - } - } - } - } - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - type_params { - fields { - generic_binding { - name: "T" - type { - type_type_literal { - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - call { - function { - simple_member_access { - field: "Origin" - object { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - argument { - tuple_literal { - fields { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "GetX" - object { - identifier { - name: "p" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/ce8a72d8214224c0cf6cd1208452aa86ddb41a3c b/explorer/fuzzing/fuzzer_corpus/ce8a72d8214224c0cf6cd1208452aa86ddb41a3c deleted file mode 100644 index 56fcafb024330..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/ce8a72d8214224c0cf6cd1208452aa86ddb41a3c +++ /dev/null @@ -1,283 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "Point" - members { - function { - name: "Origin" - param_pattern { - fields { - binding_pattern { - name: "zero" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - identifier { - name: "zero" - } - } - } - fields { - name: "y" - expression { - identifier { - name: "zero" - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "GetX" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - return_statement { - expression { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - } - } - } - } - } - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - type_params { - fields { - generic_binding { - name: "T" - type { - int_type_literal { - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - call { - function { - simple_member_access { - field: "Origin" - object { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - argument { - tuple_literal { - fields { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "GetX" - object { - identifier { - name: "p" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/cea671bbabe96758d652ca6d207eb04a82e64923 b/explorer/fuzzing/fuzzer_corpus/cea671bbabe96758d652ca6d207eb04a82e64923 deleted file mode 100644 index 90c74fdabb635..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/cea671bbabe96758d652ca6d207eb04a82e64923 +++ /dev/null @@ -1,266 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "LazyEq" - members { - variable { - binding { - name: "v1" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "v2" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Self" - } - } - interface { - call { - function { - identifier { - name: "ImplicitAs" - } - } - argument { - tuple_literal { - fields { - bool_type_literal { - } - } - } - } - } - } - members { - function { - name: "Convert" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - bool_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - operator { - op: Eq - arguments { - simple_member_access { - field: "v1" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "v2" - object { - identifier { - name: "self" - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Make" - param_pattern { - fields { - binding_pattern { - name: "v1" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - fields { - binding_pattern { - name: "v2" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "v1" - expression { - identifier { - name: "v1" - } - } - } - fields { - name: "v2" - expression { - identifier { - name: "v2" - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - if_expression { - condition { - call { - function { - simple_member_access { - field: "Make" - object { - identifier { - name: "LazyEq" - } - } - } - } - argument { - tuple_literal { - fields { - int_literal { - value: 2 - } - } - fields { - operator { - op: Add - arguments { - int_literal { - value: 1 - } - } - arguments { - int_literal { - value: 1 - } - } - } - } - } - } - } - } - then_expression { - int_literal { - value: 1 - } - } - else_expression { - int_literal { - value: 2 - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/ced66b30c1335523b9a066db3186ae300174d643 b/explorer/fuzzing/fuzzer_corpus/ced66b30c1335523b9a066db3186ae300174d643 deleted file mode 100644 index 26bd43ee521ab..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/ced66b30c1335523b9a066db3186ae300174d643 +++ /dev/null @@ -1,686 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Vector" - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Point" - } - } - interface { - identifier { - name: "Vector" - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "AddAndScaleGeneric" - deduced_parameters { - name: "T" - type { - identifier { - name: "Vector" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "t" - type { - expression_pattern { - expression { - tuple_literal { - fields { - identifier { - name: "T" - } - } - fields { - identifier { - name: "T" - } - } - } - } - } - } - } - } - fields { - binding_pattern { - name: "s" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "m" - type { - auto_pattern { - } - } - } - } - init { - simple_member_access { - field: "Add" - object { - index { - object { - identifier { - name: "t" - } - } - offset { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "n" - type { - auto_pattern { - } - } - } - } - init { - simple_member_access { - field: "Scale" - object { - call { - function { - identifier { - name: "m" - } - } - argument { - tuple_literal { - fields { - index { - object { - identifier { - name: "t" - } - } - offset { - int_literal { - value: 1 - } - } - } - } - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - call { - function { - identifier { - name: "n" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "s" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 1 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 2 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 3 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "AddAndScaleGeneric" - } - } - argument { - tuple_literal { - fields { - tuple_literal { - fields { - identifier { - name: "a" - } - } - fields { - identifier { - name: "b" - } - } - } - } - fields { - int_literal { - value: 5 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Sub - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "p" - } - } - } - } - arguments { - int_literal { - value: 15 - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/d1e5a00347368e94959ff07b93e4c6a0762091a8 b/explorer/fuzzing/fuzzer_corpus/d1e5a00347368e94959ff07b93e4c6a0762091a8 deleted file mode 100644 index d9d195fc1b245..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/d1e5a00347368e94959ff07b93e4c6a0762091a8 +++ /dev/null @@ -1,124 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "A" - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Self" - } - } - interface { - call { - function { - identifier { - name: "ImplicitAs" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - members { - function { - name: "Convert" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - int_literal { - value: 42 - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "A" - } - } - } - } - } - } - init { - struct_type_literal { - } - } - } - } - statements { - return_statement { - expression { - identifier { - name: "a" - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/dcd20be9b4193f2a2d428ca170d06e8f15066572 b/explorer/fuzzing/fuzzer_corpus/dcd20be9b4193f2a2d428ca170d06e8f15066572 deleted file mode 100644 index 410a8238865f1..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/dcd20be9b4193f2a2d428ca170d06e8f15066572 +++ /dev/null @@ -1,403 +0,0 @@ -compilation_unit { - package_statement { - package_name: "Foo" - } - is_api: true - declarations { - interface { - name: "HasF" - members { - function { - name: "F" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "o" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "X" - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Self" - } - } - interface { - identifier { - name: "HasF" - } - } - members { - function { - name: "F" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "o" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "n" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "n" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "n" - object { - identifier { - name: "o" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - variable { - binding { - name: "n" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - declarations { - class_declaration { - name: "Y" - members { - variable { - binding { - name: "m" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Self" - } - } - interface { - call { - function { - identifier { - name: "ImplicitAs" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "X" - } - } - } - } - } - } - members { - function { - name: "Convert" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "X" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "n" - expression { - simple_member_access { - field: "m" - object { - identifier { - name: "self" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "X" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "n" - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "y" - type { - expression_pattern { - expression { - identifier { - name: "Y" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "m" - expression { - int_literal { - value: 2 - } - } - } - } - } - } - } - statements { - return_statement { - expression { - simple_member_access { - field: "n" - object { - call { - function { - compound_member_access { - object { - identifier { - name: "y" - } - } - path { - compound_member_access { - object { - identifier { - name: "X" - } - } - path { - simple_member_access { - field: "F" - object { - identifier { - name: "HasF" - } - } - } - } - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "x" - } - } - } - } - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/e18e54955a7d12d8676a628f6a8a2a700d09394d b/explorer/fuzzing/fuzzer_corpus/e18e54955a7d12d8676a628f6a8a2a700d09394d deleted file mode 100644 index d9763925eebc0..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/e18e54955a7d12d8676a628f6a8a2a700d09394d +++ /dev/null @@ -1,126 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "C" - members { - function { - name: "F" - param_pattern { - } - return_term { - kind: Omitted - } - body { - } - } - } - members { - function { - name: "G" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Omitted - } - body { - } - } - } - } - } - declarations { - function { - name: "ReturnF" - param_pattern { - } - return_term { - kind: Auto - } - body { - statements { - return_statement { - expression { - simple_member_access { - field: "F" - object { - identifier { - name: "C" - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "ReturnG" - param_pattern { - } - return_term { - kind: Auto - } - body { - statements { - return_statement { - expression { - simple_member_access { - field: "G" - object { - identifier { - name: "C" - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/e29450683541d9d7ed77043b5bccc8e845fe909e b/explorer/fuzzing/fuzzer_corpus/e29450683541d9d7ed77043b5bccc8e845fe909e deleted file mode 100644 index 94c4018ebc236..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/e29450683541d9d7ed77043b5bccc8e845fe909e +++ /dev/null @@ -1,976 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Number" - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "other" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - type_params { - fields { - generic_binding { - name: "T" - type { - identifier { - name: "Number" - } - } - } - } - } - } - } - declarations { - impl { - kind: ExternalImpl - impl_type { - int_type_literal { - } - } - interface { - identifier { - name: "Number" - } - } - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "other" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - operator { - op: Add - arguments { - identifier { - name: "self" - } - } - arguments { - identifier { - name: "other" - } - } - } - } - } - } - } - } - } - } - } - declarations { - impl { - kind: ExternalImpl - impl_type { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "U" - } - } - } - } - } - } - interface { - identifier { - name: "Number" - } - } - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "U" - } - } - } - } - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "U" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - fields { - name: "y" - expression { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "U" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "U" - } - } - } - } - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "other" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "U" - } - } - } - } - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "U" - } - } - } - } - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - call { - function { - simple_member_access { - field: "Add" - object { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - } - } - argument { - tuple_literal { - fields { - simple_member_access { - field: "x" - object { - identifier { - name: "other" - } - } - } - } - } - } - } - } - } - fields { - name: "y" - expression { - call { - function { - simple_member_access { - field: "Add" - object { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - } - } - argument { - tuple_literal { - fields { - simple_member_access { - field: "y" - object { - identifier { - name: "other" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Sum" - deduced_parameters { - name: "E" - type { - identifier { - name: "Number" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "E" - } - } - } - } - } - } - fields { - binding_pattern { - name: "y" - type { - expression_pattern { - expression { - identifier { - name: "E" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "E" - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "total" - type { - expression_pattern { - expression { - identifier { - name: "E" - } - } - } - } - } - } - init { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "E" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - statements { - assign { - lhs { - identifier { - name: "total" - } - } - rhs { - call { - function { - simple_member_access { - field: "Add" - object { - identifier { - name: "total" - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "x" - } - } - } - } - } - } - } - } - statements { - assign { - lhs { - identifier { - name: "total" - } - } - rhs { - call { - function { - simple_member_access { - field: "Add" - object { - identifier { - name: "total" - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "y" - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - identifier { - name: "total" - } - } - } - } - } - } - } - declarations { - function { - name: "SumPoints" - deduced_parameters { - name: "E" - type { - identifier { - name: "Number" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "E" - } - } - } - } - } - } - } - } - } - } - fields { - binding_pattern { - name: "q" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "E" - } - } - } - } - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "E" - } - } - } - } - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - identifier { - name: "Sum" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "p" - } - } - fields { - identifier { - name: "q" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 1 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 2 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "q" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 4 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 3 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "r" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "SumPoints" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "p" - } - } - fields { - identifier { - name: "q" - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Sub - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "r" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "r" - } - } - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/e3b3b1f52b6d35189726bae3b49d358f1eda35d6 b/explorer/fuzzing/fuzzer_corpus/e3b3b1f52b6d35189726bae3b49d358f1eda35d6 deleted file mode 100644 index 72161017bdd9c..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/e3b3b1f52b6d35189726bae3b49d358f1eda35d6 +++ /dev/null @@ -1,161 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "C" - members { - function { - name: "F" - param_pattern { - } - return_term { - kind: Omitted - } - body { - } - } - } - members { - function { - name: "G" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Omitted - } - body { - } - } - } - } - } - declarations { - function { - name: "H" - deduced_parameters { - name: "T" - type { - type_type_literal { - } - } - } - param_pattern { - fields { - binding_pattern { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - return_term { - kind: Omitted - } - body { - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - expression_statement { - expression { - call { - function { - identifier { - name: "H" - } - } - argument { - tuple_literal { - fields { - simple_member_access { - field: "F" - object { - identifier { - name: "C" - } - } - } - } - } - } - } - } - } - } - statements { - expression_statement { - expression { - call { - function { - identifier { - name: "H" - } - } - argument { - tuple_literal { - fields { - simple_member_access { - field: "G" - object { - identifier { - name: "C" - } - } - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/e6c980db2dc247d290d0bef72b045ddb3bc9e712 b/explorer/fuzzing/fuzzer_corpus/e6c980db2dc247d290d0bef72b045ddb3bc9e712 deleted file mode 100644 index 113aa3266aa0a..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/e6c980db2dc247d290d0bef72b045ddb3bc9e712 +++ /dev/null @@ -1,283 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "Point" - members { - function { - name: "Origin" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 0 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "GetX" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - } - } - } - } - } - members { - function { - name: "GetXY" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - tuple_literal { - fields { - int_type_literal { - } - } - fields { - int_type_literal { - } - } - } - } - } - body { - statements { - return_statement { - expression { - tuple_literal { - fields { - call { - function { - simple_member_access { - field: "GetX" - object { - identifier { - name: "self" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - fields { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - } - } - } - } - } - } - } - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - call { - function { - simple_member_access { - field: "Origin" - object { - identifier { - name: "Point" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - statements { - return_statement { - expression { - index { - object { - call { - function { - simple_member_access { - field: "GetXY" - object { - identifier { - name: "p" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - offset { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/e9715683bb49b068d7e5848a6afa8ad6ad71bf07 b/explorer/fuzzing/fuzzer_corpus/e9715683bb49b068d7e5848a6afa8ad6ad71bf07 deleted file mode 100644 index eba3ca76563cd..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/e9715683bb49b068d7e5848a6afa8ad6ad71bf07 +++ /dev/null @@ -1,325 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "Point" - members { - function { - name: "Origin" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 0 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "GetSetX" - self_pattern { - addr_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - operator { - op: Ptr - arguments { - identifier { - name: "Point" - } - } - } - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "old" - type { - auto_pattern { - } - } - } - } - init { - simple_member_access { - field: "x" - object { - operator { - op: Deref - arguments { - identifier { - name: "self" - } - } - } - } - } - } - } - } - statements { - assign { - lhs { - simple_member_access { - field: "x" - object { - operator { - op: Deref - arguments { - identifier { - name: "self" - } - } - } - } - } - } - rhs { - identifier { - name: "x" - } - } - } - } - statements { - return_statement { - expression { - identifier { - name: "old" - } - } - } - } - } - } - } - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - call { - function { - simple_member_access { - field: "Origin" - object { - identifier { - name: "Point" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "x" - type { - auto_pattern { - } - } - } - } - init { - call { - function { - simple_member_access { - field: "GetSetX" - object { - identifier { - name: "p" - } - } - } - } - argument { - tuple_literal { - fields { - int_literal { - value: 42 - } - } - } - } - } - } - } - } - statements { - if_statement { - condition { - operator { - op: Eq - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "p" - } - } - } - } - arguments { - int_literal { - value: 42 - } - } - } - } - then_block { - statements { - return_statement { - expression { - identifier { - name: "x" - } - } - } - } - } - } - } - statements { - return_statement { - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/eeffdec7cdffe7258413447330e745427673be5b b/explorer/fuzzing/fuzzer_corpus/eeffdec7cdffe7258413447330e745427673be5b deleted file mode 100644 index 7d1cf6bd077d9..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/eeffdec7cdffe7258413447330e745427673be5b +++ /dev/null @@ -1,223 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "Point" - members { - function { - name: "Origin" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 0 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "SetX" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Omitted - } - body { - statements { - assign { - lhs { - identifier { - name: "x" - } - } - rhs { - int_literal { - value: 10 - } - } - } - } - } - } - } - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - call { - function { - simple_member_access { - field: "Origin" - object { - identifier { - name: "Point" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - statements { - expression_statement { - expression { - call { - function { - simple_member_access { - field: "SetX" - object { - identifier { - name: "p" - } - } - } - } - argument { - tuple_literal { - fields { - int_literal { - value: 42 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/ef9e4ddee87e9a1551d2cf0f56c2b2698d6000c0 b/explorer/fuzzing/fuzzer_corpus/ef9e4ddee87e9a1551d2cf0f56c2b2698d6000c0 deleted file mode 100644 index addee7400731b..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/ef9e4ddee87e9a1551d2cf0f56c2b2698d6000c0 +++ /dev/null @@ -1,283 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "Point" - members { - function { - name: "Origin" - param_pattern { - fields { - binding_pattern { - name: "zero" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - identifier { - name: "zero" - } - } - } - fields { - name: "y" - expression { - identifier { - name: "zero" - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "GetX" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - return_statement { - expression { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - } - } - } - } - } - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - type_params { - fields { - generic_binding { - name: "T" - type { - type_type_literal { - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - call { - function { - simple_member_access { - field: "Origin" - object { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - argument { - tuple_literal { - fields { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "GetX" - object { - identifier { - name: "p" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/fcbce51b08fb96910190bccab95620d12d64e5e2 b/explorer/fuzzing/fuzzer_corpus/fcbce51b08fb96910190bccab95620d12d64e5e2 deleted file mode 100644 index 238b9be313153..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/fcbce51b08fb96910190bccab95620d12d64e5e2 +++ /dev/null @@ -1,120 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - class_declaration { - name: "C" - members { - function { - name: "F" - param_pattern { - } - return_term { - kind: Omitted - } - body { - } - } - } - members { - function { - name: "G" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - } - return_term { - kind: Omitted - } - body { - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "f" - type { - auto_pattern { - } - } - } - } - init { - simple_member_access { - field: "F" - object { - identifier { - name: "C" - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "g" - type { - auto_pattern { - } - } - } - } - init { - simple_member_access { - field: "G" - object { - identifier { - name: "C" - } - } - } - } - } - } - statements { - return_statement { - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/fddfbdab89dbe1de7488636e4f664617ab2bbb68 b/explorer/fuzzing/fuzzer_corpus/fddfbdab89dbe1de7488636e4f664617ab2bbb68 deleted file mode 100644 index fdc4d1a879520..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/fddfbdab89dbe1de7488636e4f664617ab2bbb68 +++ /dev/null @@ -1,614 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Number" - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "other" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - type_params { - fields { - generic_binding { - name: "T" - type { - identifier { - name: "Number" - } - } - } - } - } - } - } - declarations { - function { - name: "Origin" - deduced_parameters { - name: "U" - type { - identifier { - name: "Number" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "other" - type { - expression_pattern { - expression { - identifier { - name: "U" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "U" - } - } - } - } - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "U" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - fields { - name: "y" - expression { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "U" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Clone" - deduced_parameters { - name: "U" - type { - identifier { - name: "Number" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "other" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "U" - } - } - } - } - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "U" - } - } - } - } - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - simple_member_access { - field: "x" - object { - identifier { - name: "other" - } - } - } - } - } - fields { - name: "y" - expression { - simple_member_access { - field: "y" - object { - identifier { - name: "other" - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "SumXY" - deduced_parameters { - name: "U" - type { - identifier { - name: "Number" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "other" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "U" - } - } - } - } - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "U" - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "Add" - object { - simple_member_access { - field: "x" - object { - identifier { - name: "other" - } - } - } - } - } - } - argument { - tuple_literal { - fields { - simple_member_access { - field: "y" - object { - identifier { - name: "other" - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - impl { - kind: ExternalImpl - impl_type { - int_type_literal { - } - } - interface { - identifier { - name: "Number" - } - } - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "other" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - operator { - op: Add - arguments { - identifier { - name: "self" - } - } - arguments { - identifier { - name: "other" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "Origin" - } - } - argument { - tuple_literal { - fields { - int_literal { - value: 0 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - call { - function { - identifier { - name: "SumXY" - } - } - argument { - tuple_literal { - fields { - call { - function { - identifier { - name: "Clone" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "p" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/ff3fae0020f618948885ab71526d70ec25893935 b/explorer/fuzzing/fuzzer_corpus/ff3fae0020f618948885ab71526d70ec25893935 deleted file mode 100644 index 1061bdf12d284..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/ff3fae0020f618948885ab71526d70ec25893935 +++ /dev/null @@ -1,712 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Vector" - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - members { - impl { - kind: InternalImpl - impl_type { - identifier { - name: "Point" - } - } - interface { - identifier { - name: "Vector" - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Add - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "b" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "Scale" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "v" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Point" - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - fields { - name: "y" - expression { - operator { - op: Mul - arguments { - simple_member_access { - field: "y" - object { - identifier { - name: "self" - } - } - } - } - arguments { - identifier { - name: "v" - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "ScaleGeneric" - deduced_parameters { - name: "U" - type { - identifier { - name: "Vector" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "c" - type { - expression_pattern { - expression { - identifier { - name: "U" - } - } - } - } - } - } - fields { - binding_pattern { - name: "s" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "U" - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "Scale" - object { - identifier { - name: "c" - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "s" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "AddAndScaleGeneric" - deduced_parameters { - name: "T" - type { - identifier { - name: "Vector" - } - } - } - param_pattern { - fields { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - fields { - binding_pattern { - name: "s" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - identifier { - name: "ScaleGeneric" - } - } - argument { - tuple_literal { - fields { - call { - function { - simple_member_access { - field: "Add" - object { - identifier { - name: "a" - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "b" - } - } - } - } - } - } - fields { - identifier { - name: "s" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "a" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 1 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 1 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "b" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - struct_literal { - fields { - name: "x" - expression { - int_literal { - value: 2 - } - } - } - fields { - name: "y" - expression { - int_literal { - value: 3 - } - } - } - } - } - } - } - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - identifier { - name: "Point" - } - } - } - } - } - } - init { - call { - function { - identifier { - name: "AddAndScaleGeneric" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "a" - } - } - fields { - identifier { - name: "b" - } - } - fields { - int_literal { - value: 5 - } - } - } - } - } - } - } - } - statements { - return_statement { - expression { - operator { - op: Sub - arguments { - simple_member_access { - field: "x" - object { - identifier { - name: "p" - } - } - } - } - arguments { - int_literal { - value: 15 - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/fuzzing/fuzzer_corpus/ff8a441cec416ebb3de16074ce2e864cab65cf16 b/explorer/fuzzing/fuzzer_corpus/ff8a441cec416ebb3de16074ce2e864cab65cf16 deleted file mode 100644 index 93969dabbb614..0000000000000 --- a/explorer/fuzzing/fuzzer_corpus/ff8a441cec416ebb3de16074ce2e864cab65cf16 +++ /dev/null @@ -1,565 +0,0 @@ -compilation_unit { - package_statement { - package_name: "ExplorerTest" - } - is_api: true - declarations { - interface { - name: "Number" - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "other" - type { - expression_pattern { - expression { - identifier { - name: "Self" - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "Self" - } - } - } - } - } - self { - name: "Self" - type { - type_type_literal { - } - } - } - } - } - declarations { - class_declaration { - name: "Point" - members { - function { - name: "Origin" - param_pattern { - } - return_term { - kind: Expression - type { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - } - body { - statements { - return_statement { - expression { - struct_literal { - fields { - name: "x" - expression { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "T" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - fields { - name: "y" - expression { - call { - function { - simple_member_access { - field: "Zero" - object { - identifier { - name: "T" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "SumXY" - param_pattern { - fields { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - identifier { - name: "T" - } - } - } - body { - statements { - return_statement { - expression { - call { - function { - simple_member_access { - field: "Add" - object { - simple_member_access { - field: "x" - object { - identifier { - name: "p" - } - } - } - } - } - } - argument { - tuple_literal { - fields { - simple_member_access { - field: "y" - object { - identifier { - name: "p" - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - function { - name: "SumFn" - param_pattern { - } - return_term { - kind: Expression - type { - function_type { - parameter { - fields { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - } - return_type { - identifier { - name: "T" - } - } - } - } - } - body { - statements { - return_statement { - expression { - simple_member_access { - field: "SumXY" - object { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - identifier { - name: "T" - } - } - } - } - } - } - } - } - } - } - } - } - } - members { - variable { - binding { - name: "x" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - members { - variable { - binding { - name: "y" - type { - expression_pattern { - expression { - identifier { - name: "T" - } - } - } - } - } - } - } - type_params { - fields { - generic_binding { - name: "T" - type { - identifier { - name: "Number" - } - } - } - } - } - } - } - declarations { - impl { - kind: ExternalImpl - impl_type { - int_type_literal { - } - } - interface { - identifier { - name: "Number" - } - } - members { - function { - name: "Zero" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - int_literal { - value: 0 - } - } - } - } - } - } - } - members { - function { - name: "Add" - self_pattern { - binding_pattern { - name: "self" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - param_pattern { - fields { - binding_pattern { - name: "other" - type { - expression_pattern { - expression { - int_type_literal { - } - } - } - } - } - } - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - return_statement { - expression { - operator { - op: Add - arguments { - identifier { - name: "self" - } - } - arguments { - identifier { - name: "other" - } - } - } - } - } - } - } - } - } - } - } - declarations { - function { - name: "Main" - param_pattern { - } - return_term { - kind: Expression - type { - int_type_literal { - } - } - } - body { - statements { - variable_definition { - pattern { - binding_pattern { - name: "p" - type { - expression_pattern { - expression { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - } - } - init { - call { - function { - simple_member_access { - field: "Origin" - object { - call { - function { - identifier { - name: "Point" - } - } - argument { - tuple_literal { - fields { - int_type_literal { - } - } - } - } - } - } - } - } - argument { - tuple_literal { - } - } - } - } - } - } - statements { - return_statement { - expression { - call { - function { - call { - function { - simple_member_access { - field: "SumFn" - object { - identifier { - name: "p" - } - } - } - } - argument { - tuple_literal { - } - } - } - } - argument { - tuple_literal { - fields { - identifier { - name: "p" - } - } - } - } - } - } - } - } - } - } - } -} diff --git a/explorer/interpreter/impl_scope.h b/explorer/interpreter/impl_scope.h index 4bf21d99afb5f..123b1eecdb877 100644 --- a/explorer/interpreter/impl_scope.h +++ b/explorer/interpreter/impl_scope.h @@ -24,11 +24,11 @@ class TypeChecker; // // class C(U:! Type, T:! Type) { // class D(V:! Type where U is Fooable(T)) { -// fn bar[self: Self](x: U, y : T) -> T{ +// fn bar[me: Self](x: U, y : T) -> T{ // return x.foo(y) // } // } -// fn baz[self: Self](x: U, y : T) -> T { +// fn baz[me: Self](x: U, y : T) -> T { // return x.foo(y); // } // } diff --git a/explorer/interpreter/interpreter.cpp b/explorer/interpreter/interpreter.cpp index a52980568cdc3..5fcfc6bb45249 100644 --- a/explorer/interpreter/interpreter.cpp +++ b/explorer/interpreter/interpreter.cpp @@ -778,8 +778,8 @@ auto Interpreter::CallFunction(const CallExpression& call, call.source_loc())); RuntimeScope method_scope(&heap_); BindingMap generic_args; - // Bind the receiver to the `self` parameter. - CARBON_CHECK(PatternMatch(&method.self_pattern().value(), m.receiver(), + // Bind the receiver to the `me` parameter. + CARBON_CHECK(PatternMatch(&method.me_pattern().value(), m.receiver(), call.source_loc(), &method_scope, generic_args, trace_stream_, this->arena_)); // Bind the arguments to the parameters. diff --git a/explorer/interpreter/resolve_names.cpp b/explorer/interpreter/resolve_names.cpp index c770988ee7561..1070742558147 100644 --- a/explorer/interpreter/resolve_names.cpp +++ b/explorer/interpreter/resolve_names.cpp @@ -518,7 +518,7 @@ static auto ResolveNames(Declaration& declaration, StaticScope& enclosing_scope, } if (function.is_method()) { CARBON_RETURN_IF_ERROR( - ResolveNames(function.self_pattern(), function_scope)); + ResolveNames(function.me_pattern(), function_scope)); } CARBON_RETURN_IF_ERROR( ResolveNames(function.param_pattern(), function_scope)); diff --git a/explorer/interpreter/type_checker.cpp b/explorer/interpreter/type_checker.cpp index af8d500a9ccde..804c6e2ecf0c0 100644 --- a/explorer/interpreter/type_checker.cpp +++ b/explorer/interpreter/type_checker.cpp @@ -1569,13 +1569,12 @@ auto TypeChecker::TypeCheckExp(Nonnull e, break; case DeclarationKind::FunctionDeclaration: { auto func_decl = cast(*member); - if (func_decl->is_method() && - func_decl->self_pattern().kind() == - PatternKind::AddrPattern) { + if (func_decl->is_method() && func_decl->me_pattern().kind() == + PatternKind::AddrPattern) { access.set_is_field_addr_me_method(); Nonnull me_type = Substitute(t_class.type_args(), - &func_decl->self_pattern().static_type()); + &func_decl->me_pattern().static_type()); CARBON_RETURN_IF_ERROR(ExpectType( e->source_loc(), "method access, receiver type", me_type, &access.object().static_type(), impl_scope)); @@ -2962,9 +2961,9 @@ auto TypeChecker::DeclareFunctionDeclaration(Nonnull f, // Type check the receiver pattern. if (f->is_method()) { CARBON_RETURN_IF_ERROR(TypeCheckPattern( - &f->self_pattern(), std::nullopt, function_scope, ValueCategory::Let)); - CollectGenericBindingsInPattern(&f->self_pattern(), deduced_bindings); - CollectImplBindingsInPattern(&f->self_pattern(), impl_bindings); + &f->me_pattern(), std::nullopt, function_scope, ValueCategory::Let)); + CollectGenericBindingsInPattern(&f->me_pattern(), deduced_bindings); + CollectImplBindingsInPattern(&f->me_pattern(), impl_bindings); } // Type check the parameter pattern. CARBON_RETURN_IF_ERROR(TypeCheckPattern(&f->param_pattern(), std::nullopt, diff --git a/explorer/interpreter/value.h b/explorer/interpreter/value.h index 0134c4af401f0..2f626589e38d2 100644 --- a/explorer/interpreter/value.h +++ b/explorer/interpreter/value.h @@ -88,7 +88,7 @@ class Value { LLVM_DUMP_METHOD void Dump() const { Print(llvm::errs()); } // Returns the sub-Value specified by `path`, which must be a valid field - // path for *this. If the sub-Value is a method and its self_pattern is an + // path for *this. If the sub-Value is a method and its me_pattern is an // AddrPattern, then pass the LValue representing the receiver as `me_value`, // otherwise pass `*this`. auto GetMember(Nonnull arena, const FieldPath& path, diff --git a/explorer/testdata/addr/fail-method-let.carbon b/explorer/testdata/addr/fail-method-let.carbon index 73d640eb04e73..5d6866d9f6514 100644 --- a/explorer/testdata/addr/fail-method-let.carbon +++ b/explorer/testdata/addr/fail-method-let.carbon @@ -16,9 +16,9 @@ class Point { return {.x = 0, .y = 0}; } - fn GetSetX[addr self: Point*](x: i32) -> i32 { - var old: auto = (*self).x; - (*self).x = x; + fn GetSetX[addr me: Point*](x: i32) -> i32 { + var old: auto = (*me).x; + (*me).x = x; return old; } diff --git a/explorer/testdata/addr/fail-method-self-type.carbon b/explorer/testdata/addr/fail-method-self-type.carbon deleted file mode 100644 index 835deaf13dc41..0000000000000 --- a/explorer/testdata/addr/fail-method-self-type.carbon +++ /dev/null @@ -1,41 +0,0 @@ -// 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: %{not} %{explorer} %s 2>&1 | \ -// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s -// RUN: %{not} %{explorer} --parser_debug --trace_file=- %s 2>&1 | \ -// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s -// AUTOUPDATE: %{explorer} %s - -package ExplorerTest api; - -class Shape { - var x: i32; -} - -class Point { - - fn Origin() -> Point { - return {.x = 0, .y = 0}; - } - - fn GetSetX[addr self: Shape*](x: i32) -> i32 { - var old: auto = (*self).x; - (*self).x = x; - return old; - } - - var x: i32; - var y: i32; -} - -fn Main() -> i32 { - var p: Point = Point.Origin(); - // CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/addr/fail-method-self-type.carbon:[[@LINE+1]]: type error in method access, receiver type: 'class Point' is not implicitly convertible to 'class Shape' - var x: auto = p.GetSetX(42); - if (p.x == 42) { - return x; - } - return 1; -} diff --git a/explorer/testdata/addr/method.carbon b/explorer/testdata/addr/method.carbon index 8bf0052e0c713..c1e70582e0700 100644 --- a/explorer/testdata/addr/method.carbon +++ b/explorer/testdata/addr/method.carbon @@ -17,9 +17,9 @@ class Point { return {.x = 0, .y = 0}; } - fn GetSetX[addr self: Point*](x: i32) -> i32 { - var old: auto = (*self).x; - (*self).x = x; + fn GetSetX[addr me: Point*](x: i32) -> i32 { + var old: auto = (*me).x; + (*me).x = x; return old; } diff --git a/explorer/testdata/addr/nested-method.carbon b/explorer/testdata/addr/nested-method.carbon index 6609a19a963b9..cf35a423246ef 100644 --- a/explorer/testdata/addr/nested-method.carbon +++ b/explorer/testdata/addr/nested-method.carbon @@ -15,9 +15,9 @@ package ExplorerTest api; class B { var x: i32; - fn GetSetX[addr self: Self*](x: i32) -> i32 { - var oldX: auto = (*self).x; - (*self).x = x; + fn GetSetX[addr me: Self*](x: i32) -> i32 { + var oldX: auto = (*me).x; + (*me).x = x; return oldX; } } diff --git a/explorer/testdata/alias/class_alias.carbon b/explorer/testdata/alias/class_alias.carbon index 3ad82e585238b..754fbbe0b7109 100644 --- a/explorer/testdata/alias/class_alias.carbon +++ b/explorer/testdata/alias/class_alias.carbon @@ -15,16 +15,16 @@ package ExplorerTest api; interface Addable { - fn Add[self: Self](k: i32) -> Self; + fn Add[me: Self](k: i32) -> Self; } impl i32 as Addable { - fn Add[self: Self](k: i32) -> Self { return self + k; } + fn Add[me: Self](k: i32) -> Self { return me + k; } } class Class { var n: i32; } class GenericClass(T:! Addable) { var m: T; - fn Get[self: Self](n: i32) -> T { return self.m.Add(n); } + fn Get[me: Self](n: i32) -> T { return me.m.Add(n); } } alias ClassAlias = Class; diff --git a/explorer/testdata/alias/member_name_alias.carbon b/explorer/testdata/alias/member_name_alias.carbon index 7b96c48483389..f6da101a1a7ae 100644 --- a/explorer/testdata/alias/member_name_alias.carbon +++ b/explorer/testdata/alias/member_name_alias.carbon @@ -13,19 +13,19 @@ package ExplorerTest api; interface I { fn F() -> i32; - fn M[self: Self]() -> i32; + fn M[me: Self]() -> i32; } class A { var n: i32; impl as I { fn F() -> i32 { return 1; } - fn M[self: Self]() -> i32 { return 2; } + fn M[me: Self]() -> i32 { return 2; } } - fn G[self: Self]() -> i32 { return 3; } + fn G[me: Self]() -> i32 { return 3; } } impl i32 as I { fn F() -> i32 { return 4; } - fn M[self: Self]() -> i32 { return 5; } + fn M[me: Self]() -> i32 { return 5; } } alias IF = I.F; diff --git a/explorer/testdata/as/convert.carbon b/explorer/testdata/as/convert.carbon index 8d1e2a2c6de35..0e71efeca6774 100644 --- a/explorer/testdata/as/convert.carbon +++ b/explorer/testdata/as/convert.carbon @@ -14,7 +14,7 @@ package ExplorerTest api; class A { var n: i32; } external impl A as As(i32) { - fn Convert[self: Self]() -> i32 { return self.n; } + fn Convert[me: Self]() -> i32 { return me.n; } } fn Main() -> i32 { diff --git a/explorer/testdata/as/implicit_as.carbon b/explorer/testdata/as/implicit_as.carbon index 9e6e85709a348..d2cd3b5aec69d 100644 --- a/explorer/testdata/as/implicit_as.carbon +++ b/explorer/testdata/as/implicit_as.carbon @@ -14,7 +14,7 @@ package ExplorerTest api; class A { var n: i32; } external impl A as ImplicitAs(i32) { - fn Convert[self: Self]() -> i32 { return self.n; } + fn Convert[me: Self]() -> i32 { return me.n; } } fn Main() -> i32 { diff --git a/explorer/testdata/assign/convert_rhs.carbon b/explorer/testdata/assign/convert_rhs.carbon index 87c37f32aa90a..2bdd5b5ef9f99 100644 --- a/explorer/testdata/assign/convert_rhs.carbon +++ b/explorer/testdata/assign/convert_rhs.carbon @@ -15,7 +15,7 @@ class A { var n: i32; } impl i32 as ImplicitAs(A) { - fn Convert[self: Self]() -> A { return {.n = self }; } + fn Convert[me: Self]() -> A { return {.n = me }; } } fn Main() -> i32 { diff --git a/explorer/testdata/assoc_const/fail_multiple_deduction.carbon b/explorer/testdata/assoc_const/fail_multiple_deduction.carbon index 61c14b09daa1e..7c36edf00848f 100644 --- a/explorer/testdata/assoc_const/fail_multiple_deduction.carbon +++ b/explorer/testdata/assoc_const/fail_multiple_deduction.carbon @@ -14,7 +14,7 @@ interface HasThreeTypes { let A:! Type; let B:! Type; let C:! Type; - fn Make[self: Self]() -> (A, B, C); + fn Make[me: Self]() -> (A, B, C); } fn F[T:! Type](x: (T, T, T)); fn G[X:! HasThreeTypes where .A == .B and .B == .C and .C == .A](x: X) { diff --git a/explorer/testdata/assoc_const/impl_lookup.carbon b/explorer/testdata/assoc_const/impl_lookup.carbon index e7731c0c98536..542fa80daec63 100644 --- a/explorer/testdata/assoc_const/impl_lookup.carbon +++ b/explorer/testdata/assoc_const/impl_lookup.carbon @@ -13,7 +13,7 @@ package ExplorerTest api; interface Frob { let Result:! Type; - fn F[self: Self]() -> Result; + fn F[me: Self]() -> Result; } fn Use[T:! Frob](x: T) -> T.Result { @@ -24,12 +24,12 @@ fn Use[T:! Frob](x: T) -> T.Result { class AlmostI32 { var val: i32; impl as ImplicitAs(i32) { - fn Convert[self: Self]() -> i32 { return self.val; } + fn Convert[me: Self]() -> i32 { return me.val; } } } impl i32 as Frob where .Result == AlmostI32 { - fn F[self: Self]() -> AlmostI32 { return {.val = self}; } + fn F[me: Self]() -> AlmostI32 { return {.val = me}; } } fn Main() -> i32 { diff --git a/explorer/testdata/assoc_const/simple_constraint.carbon b/explorer/testdata/assoc_const/simple_constraint.carbon index 5f9ccfc13f7d0..e6998b8e86bca 100644 --- a/explorer/testdata/assoc_const/simple_constraint.carbon +++ b/explorer/testdata/assoc_const/simple_constraint.carbon @@ -13,7 +13,7 @@ package ExplorerTest api; interface Frob { let Result:! Type; - fn F[self: Self]() -> Result; + fn F[me: Self]() -> Result; } fn Use[T:! Frob where .Result == .Self](x: T) -> T { @@ -22,7 +22,7 @@ fn Use[T:! Frob where .Result == .Self](x: T) -> T { } impl i32 as Frob where .Result == i32 { - fn F[self: Self]() -> i32 { return self + 1; } + fn F[me: Self]() -> i32 { return me + 1; } } fn Main() -> i32 { diff --git a/explorer/testdata/assoc_const/simple_equality.carbon b/explorer/testdata/assoc_const/simple_equality.carbon index dde8ae2c533e6..25736ebda1b3a 100644 --- a/explorer/testdata/assoc_const/simple_equality.carbon +++ b/explorer/testdata/assoc_const/simple_equality.carbon @@ -13,7 +13,7 @@ package ExplorerTest api; interface Frob { let Result:! Type; - fn F[self: Self]() -> Result; + fn F[me: Self]() -> Result; } fn Use[T:! Frob](x: T) -> T.Result { @@ -22,7 +22,7 @@ fn Use[T:! Frob](x: T) -> T.Result { } impl i32 as Frob where .Result == i32 { - fn F[self: Self]() -> i32 { return 0; } + fn F[me: Self]() -> i32 { return 0; } } fn Main() -> i32 { diff --git a/explorer/testdata/class/bound_method.carbon b/explorer/testdata/class/bound_method.carbon index c6f9e1d351120..0d73ebed84eb3 100644 --- a/explorer/testdata/class/bound_method.carbon +++ b/explorer/testdata/class/bound_method.carbon @@ -15,8 +15,8 @@ class Point { fn Origin() -> Point { return {.x = 0, .y = 0}; } - fn GetX[self: Point]() -> i32 { - return self.x; + fn GetX[me: Point]() -> i32 { + return me.x; } var x: i32; var y: i32; diff --git a/explorer/testdata/class/empty_class.carbon b/explorer/testdata/class/empty_class.carbon index 313a6ce00c9ff..3133a683c777c 100644 --- a/explorer/testdata/class/empty_class.carbon +++ b/explorer/testdata/class/empty_class.carbon @@ -11,7 +11,7 @@ package ExplorerTest api; -class A { fn F[self: Self]() -> i32 { return 0; } } +class A { fn F[me: Self]() -> i32 { return 0; } } fn Main() -> i32 { // {} is a bit strange; its type is {}. Make sure we can properly convert a diff --git a/explorer/testdata/class/fail_method_deduced.carbon b/explorer/testdata/class/fail_method_deduced.carbon index 96b410db9e2c3..f011182006db8 100644 --- a/explorer/testdata/class/fail_method_deduced.carbon +++ b/explorer/testdata/class/fail_method_deduced.carbon @@ -12,7 +12,7 @@ package ExplorerTest api; class C { fn F() {} - fn G[self: Self]() {} + fn G[me: Self]() {} } fn H[T:! Type](x: T) {} diff --git a/explorer/testdata/class/fail_method_from_class.carbon b/explorer/testdata/class/fail_method_from_class.carbon index 78c6a9ae08061..414747b9f08ea 100644 --- a/explorer/testdata/class/fail_method_from_class.carbon +++ b/explorer/testdata/class/fail_method_from_class.carbon @@ -15,8 +15,8 @@ class Point { return {.x = 0, .y = 0}; } - fn GetX[self: Point]() -> i32 { - return self.x; + fn GetX[me: Point]() -> i32 { + return me.x; } var x: i32; diff --git a/explorer/testdata/class/fail_method_in_var.carbon b/explorer/testdata/class/fail_method_in_var.carbon index 739de304c18b0..58cfdfd42bbfa 100644 --- a/explorer/testdata/class/fail_method_in_var.carbon +++ b/explorer/testdata/class/fail_method_in_var.carbon @@ -12,7 +12,7 @@ package ExplorerTest api; class C { fn F() {} - fn G[self: Self]() {} + fn G[me: Self]() {} } fn Main() -> i32 { diff --git a/explorer/testdata/class/fail_return_method.carbon b/explorer/testdata/class/fail_return_method.carbon index 1ae204945d60e..ef6e05ecf0134 100644 --- a/explorer/testdata/class/fail_return_method.carbon +++ b/explorer/testdata/class/fail_return_method.carbon @@ -12,7 +12,7 @@ package ExplorerTest api; class C { fn F() {} - fn G[self: Self]() {} + fn G[me: Self]() {} } fn ReturnF() -> auto { return C.F; } diff --git a/explorer/testdata/class/method.carbon b/explorer/testdata/class/method.carbon index 5cfa6cf73e954..64871158213b2 100644 --- a/explorer/testdata/class/method.carbon +++ b/explorer/testdata/class/method.carbon @@ -16,8 +16,8 @@ class Point { return {.x = 0, .y = 0}; } - fn GetX[self: Point]() -> i32 { - return self.x; + fn GetX[me: Point]() -> i32 { + return me.x; } var x: i32; diff --git a/explorer/testdata/class/method_call_method.carbon b/explorer/testdata/class/method_call_method.carbon index 2c90363446d4a..dd72eb81846e1 100644 --- a/explorer/testdata/class/method_call_method.carbon +++ b/explorer/testdata/class/method_call_method.carbon @@ -16,12 +16,12 @@ class Point { return {.x = 0, .y = 0}; } - fn GetX[self: Point]() -> i32 { - return self.x; + fn GetX[me: Point]() -> i32 { + return me.x; } - fn GetXY[self: Point]() -> (i32, i32) { - return (self.GetX(), self.y); + fn GetXY[me: Point]() -> (i32, i32) { + return (me.GetX(), me.y); } var x: i32; diff --git a/explorer/testdata/class/method_self.carbon b/explorer/testdata/class/method_self.carbon index 2e5ca84c8e35c..af7a184e0aaa2 100644 --- a/explorer/testdata/class/method_self.carbon +++ b/explorer/testdata/class/method_self.carbon @@ -17,8 +17,8 @@ class Point { } // Allowed: `Self` here means `Point`. - fn GetX[self: Self]() -> i32 { - return self.x; + fn GetX[me: Self]() -> i32 { + return me.x; } var x: i32; diff --git a/explorer/testdata/constraint/binding_self.carbon b/explorer/testdata/constraint/binding_self.carbon index bb7473d794ca3..3ef0e6c2040cd 100644 --- a/explorer/testdata/constraint/binding_self.carbon +++ b/explorer/testdata/constraint/binding_self.carbon @@ -12,11 +12,11 @@ package ExplorerTest api; interface SwizzleWith(T:! Type) { - fn Op[self: Self](x: T) -> i32; + fn Op[me: Self](x: T) -> i32; } impl i32 as SwizzleWith(i32) { - fn Op[self: Self](x: Self) -> Self { return self * 10 + x; } + fn Op[me: Self](x: Self) -> Self { return me * 10 + x; } } fn F[T:! SwizzleWith(.Self)](v: T, w: T) -> i32 { diff --git a/explorer/testdata/constraint/where_self.carbon b/explorer/testdata/constraint/where_self.carbon index 14b2e506231cc..3abf0d78ef6cf 100644 --- a/explorer/testdata/constraint/where_self.carbon +++ b/explorer/testdata/constraint/where_self.carbon @@ -12,7 +12,7 @@ package ExplorerTest api; interface SwizzleWith(T:! Type) { - fn Op[self: Self](x: T) -> i32; + fn Op[me: Self](x: T) -> i32; } // TODO: There should be some way to write this that includes @@ -20,7 +20,7 @@ interface SwizzleWith(T:! Type) { alias Swizzle = Type where .Self is SwizzleWith(.Self); impl i32 as SwizzleWith(i32) { - fn Op[self: Self](x: Self) -> Self { return self * 10 + x; } + fn Op[me: Self](x: Self) -> Self { return me * 10 + x; } } fn F[T:! Swizzle](v: T, w: T) -> i32 { diff --git a/explorer/testdata/experimental_continuation/convert_run.carbon b/explorer/testdata/experimental_continuation/convert_run.carbon index 24ab7f81b42ac..c3a08f2c9fec2 100644 --- a/explorer/testdata/experimental_continuation/convert_run.carbon +++ b/explorer/testdata/experimental_continuation/convert_run.carbon @@ -17,8 +17,8 @@ class Wrap(T:! Type) { fn MakeWrap[T:! Type](x: T) -> Wrap(T) { return {.v = x}; } impl forall [T:! Type] Wrap(T) as ImplicitAs(T) { - fn Convert[self: Self]() -> T { - return self.v; + fn Convert[me: Self]() -> T { + return me.v; } } diff --git a/explorer/testdata/function/convert_args.carbon b/explorer/testdata/function/convert_args.carbon index 5802f7329e6f7..9b094843edfbd 100644 --- a/explorer/testdata/function/convert_args.carbon +++ b/explorer/testdata/function/convert_args.carbon @@ -13,19 +13,19 @@ package ExplorerTest api; class One { impl One as ImplicitAs(i32) { - fn Convert[self: Self]() -> i32 { return 1; } + fn Convert[me: Self]() -> i32 { return 1; } } } class Two { impl Two as ImplicitAs(i32) { - fn Convert[self: Self]() -> i32 { return 2; } + fn Convert[me: Self]() -> i32 { return 2; } } } class N { impl N as ImplicitAs(i32) { - fn Convert[self: Self]() -> i32 { return self.n; } + fn Convert[me: Self]() -> i32 { return me.n; } } var n: i32; } diff --git a/explorer/testdata/generic_class/class_function.carbon b/explorer/testdata/generic_class/class_function.carbon index d798b2f31bbd7..49017109bf7bc 100644 --- a/explorer/testdata/generic_class/class_function.carbon +++ b/explorer/testdata/generic_class/class_function.carbon @@ -13,7 +13,7 @@ package ExplorerTest api; interface Number { fn Zero() -> Self; - fn Add[self: Self](other: Self) -> Self; + fn Add[me: Self](other: Self) -> Self; } class Point(T:! Number) { @@ -32,7 +32,7 @@ class Point(T:! Number) { external impl i32 as Number { fn Zero() -> i32 { return 0; } - fn Add[self: i32](other: i32) -> i32 { return self + other; } + fn Add[me: i32](other: i32) -> i32 { return me + other; } } fn Main() -> i32 { diff --git a/explorer/testdata/generic_class/fail_args_mismatch.carbon b/explorer/testdata/generic_class/fail_args_mismatch.carbon index 6dd84c0bd891b..62eca4c7ae75f 100644 --- a/explorer/testdata/generic_class/fail_args_mismatch.carbon +++ b/explorer/testdata/generic_class/fail_args_mismatch.carbon @@ -15,8 +15,8 @@ class Point(T:! Type) { return {.x = zero, .y = zero}; } - fn GetX[self: Point(T, T)]() -> T { - return self.x; + fn GetX[me: Point(T, T)]() -> T { + return me.x; } var x: T; diff --git a/explorer/testdata/generic_class/fail_bad_parameter_type.carbon b/explorer/testdata/generic_class/fail_bad_parameter_type.carbon index e74da653750e3..03839182c87ab 100644 --- a/explorer/testdata/generic_class/fail_bad_parameter_type.carbon +++ b/explorer/testdata/generic_class/fail_bad_parameter_type.carbon @@ -15,8 +15,8 @@ class Point(T:! i32) { return {.x = zero, .y = zero}; } - fn GetX[self: Point(T)]() -> T { - return self.x; + fn GetX[me: Point(T)]() -> T { + return me.x; } var x: T; diff --git a/explorer/testdata/generic_class/fail_no_args.carbon b/explorer/testdata/generic_class/fail_no_args.carbon index cc85c5609ea11..b737d1c7ccdd4 100644 --- a/explorer/testdata/generic_class/fail_no_args.carbon +++ b/explorer/testdata/generic_class/fail_no_args.carbon @@ -17,8 +17,8 @@ class Point(T:! Type) { // Error: wrote `Point` instead of `Point(T)`, `Point` by itself is not a type. // CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_class/fail_no_args.carbon:[[@LINE+1]]: Expected a type, but got Point - fn GetX[self: Point]() -> T { - return self.x; + fn GetX[me: Point]() -> T { + return me.x; } var x: T; diff --git a/explorer/testdata/generic_class/fail_self_with_arg.carbon b/explorer/testdata/generic_class/fail_self_with_arg.carbon index 200747961265c..44600e9081d61 100644 --- a/explorer/testdata/generic_class/fail_self_with_arg.carbon +++ b/explorer/testdata/generic_class/fail_self_with_arg.carbon @@ -19,8 +19,8 @@ class Point(T:! Type) { } // Error: wrote `Self(T)` instead of `Self`. - fn GetX[self: Self(T)]() -> T { - return self.x; + fn GetX[me: Self(T)]() -> T { + return me.x; } var x: T; diff --git a/explorer/testdata/generic_class/fail_two_arg_lists.carbon b/explorer/testdata/generic_class/fail_two_arg_lists.carbon index 5490dd21547c4..262785406274b 100644 --- a/explorer/testdata/generic_class/fail_two_arg_lists.carbon +++ b/explorer/testdata/generic_class/fail_two_arg_lists.carbon @@ -16,8 +16,8 @@ class Point(T:! Type) { return {.x = zero, .y = zero}; } - fn GetX[self: Point(T)(T)]() -> T { - return self.x; + fn GetX[me: Point(T)(T)]() -> T { + return me.x; } var x: T; diff --git a/explorer/testdata/generic_class/generic_class_substitution.carbon b/explorer/testdata/generic_class/generic_class_substitution.carbon index d01bf2d82678f..bf22c5a61cc34 100644 --- a/explorer/testdata/generic_class/generic_class_substitution.carbon +++ b/explorer/testdata/generic_class/generic_class_substitution.carbon @@ -13,7 +13,7 @@ package ExplorerTest api; interface Number { fn Zero() -> Self; - fn Add[self: Self](other: Self) -> Self; + fn Add[me: Self](other: Self) -> Self; } class Point(T:! Number) { @@ -26,7 +26,7 @@ class Point(T:! Number) { external impl i32 as Number { fn Zero() -> i32 { return 0; } - fn Add[self: i32](other: i32) -> i32 { return self + other; } + fn Add[me: i32](other: i32) -> i32 { return me + other; } } fn SumXY[U:! Number](p: Point(U)) -> U { diff --git a/explorer/testdata/generic_class/generic_fun_and_class.carbon b/explorer/testdata/generic_class/generic_fun_and_class.carbon index 63ce01a6d7442..f62ea7a54e2ef 100644 --- a/explorer/testdata/generic_class/generic_fun_and_class.carbon +++ b/explorer/testdata/generic_class/generic_fun_and_class.carbon @@ -13,7 +13,7 @@ package ExplorerTest api; interface Number { fn Zero() -> Self; - fn Add[self: Self](other: Self) -> Self; + fn Add[me: Self](other: Self) -> Self; } class Point(T:! Number) { @@ -35,7 +35,7 @@ fn SumXY[U :! Number](other: Point(U)) -> U { external impl i32 as Number { fn Zero() -> i32 { return 0; } - fn Add[self: i32](other: i32) -> i32 { return self + other; } + fn Add[me: i32](other: i32) -> i32 { return me + other; } } fn Main() -> i32 { diff --git a/explorer/testdata/generic_class/generic_point.carbon b/explorer/testdata/generic_class/generic_point.carbon index a4d8756853650..58d39d257aa62 100644 --- a/explorer/testdata/generic_class/generic_point.carbon +++ b/explorer/testdata/generic_class/generic_point.carbon @@ -16,8 +16,8 @@ class Point(T:! Type) { return {.x = zero, .y = zero}; } - fn GetX[self: Point(T)]() -> T { - return self.x; + fn GetX[me: Point(T)]() -> T { + return me.x; } var x: T; diff --git a/explorer/testdata/generic_class/impl_with_argument.carbon b/explorer/testdata/generic_class/impl_with_argument.carbon index 48fc8e353c628..6bef60e3ebb3a 100644 --- a/explorer/testdata/generic_class/impl_with_argument.carbon +++ b/explorer/testdata/generic_class/impl_with_argument.carbon @@ -13,8 +13,8 @@ package ExplorerTest api; interface Vector { fn Zero() -> Self; - fn Add[self: Self](b: Self) -> Self; - fn Scale[self: Self](v: i32) -> Self; + fn Add[me: Self](b: Self) -> Self; + fn Scale[me: Self](v: i32) -> Self; } class Point(T:! Type) { @@ -28,12 +28,12 @@ external impl Point(i32) as Vector { return {.x = 0, .y = 0}; } - fn Add[self: Point(i32)](b: Point(i32)) -> Point(i32) { - return {.x = self.x + b.x, .y = self.y + b.y}; + fn Add[me: Point(i32)](b: Point(i32)) -> Point(i32) { + return {.x = me.x + b.x, .y = me.y + b.y}; } - fn Scale[self: Point(i32)](v: i32) -> Point(i32) { - return {.x = self.x * v, .y = self.y * v}; + fn Scale[me: Point(i32)](v: i32) -> Point(i32) { + return {.x = me.x * v, .y = me.y * v}; } } diff --git a/explorer/testdata/generic_class/impl_with_self.carbon b/explorer/testdata/generic_class/impl_with_self.carbon index 23a6b17830eba..edfa65b6e7ccf 100644 --- a/explorer/testdata/generic_class/impl_with_self.carbon +++ b/explorer/testdata/generic_class/impl_with_self.carbon @@ -13,8 +13,8 @@ package ExplorerTest api; interface Vector { fn Zero() -> Self; - fn Add[self: Self](b: Self) -> Self; - fn Scale[self: Self](v: i32) -> Self; + fn Add[me: Self](b: Self) -> Self; + fn Scale[me: Self](v: i32) -> Self; } class Point(T:! Type) { @@ -28,12 +28,12 @@ external impl Point(i32) as Vector { return {.x = 0, .y = 0}; } - fn Add[self: Self](b: Self) -> Self { - return {.x = self.x + b.x, .y = self.y + b.y}; + fn Add[me: Self](b: Self) -> Self { + return {.x = me.x + b.x, .y = me.y + b.y}; } - fn Scale[self: Self](v: i32) -> Self { - return {.x = self.x * v, .y = self.y * v}; + fn Scale[me: Self](v: i32) -> Self { + return {.x = me.x * v, .y = me.y * v}; } } diff --git a/explorer/testdata/generic_class/param_with_dependent_type.carbon b/explorer/testdata/generic_class/param_with_dependent_type.carbon index da18f416b9306..12b1cab95ae4e 100644 --- a/explorer/testdata/generic_class/param_with_dependent_type.carbon +++ b/explorer/testdata/generic_class/param_with_dependent_type.carbon @@ -12,7 +12,7 @@ package ExplorerTest api; class Point(T:! Type, V:! T) { - fn Get[self: Self]() -> T { + fn Get[me: Self]() -> T { return V; } } diff --git a/explorer/testdata/generic_class/point_with_interface.carbon b/explorer/testdata/generic_class/point_with_interface.carbon index fda5871dff542..948cda25954fc 100644 --- a/explorer/testdata/generic_class/point_with_interface.carbon +++ b/explorer/testdata/generic_class/point_with_interface.carbon @@ -13,18 +13,18 @@ package ExplorerTest api; interface Number { fn Zero() -> Self; - fn Add[self: Self](other: Self) -> Self; + fn Add[me: Self](other: Self) -> Self; } class Point(T:! Number) { fn Origin() -> Point(T) { return {.x = T.Zero(), .y = T.Zero()}; } - fn Clone[self: Point(T)]() -> Point(T) { - return {.x = self.x, .y = self.y}; + fn Clone[me: Point(T)]() -> Point(T) { + return {.x = me.x, .y = me.y}; } - fn SumXY[self: Point(T)]() -> T { - return self.x.Add(self.y); + fn SumXY[me: Point(T)]() -> T { + return me.x.Add(me.y); } var x: T; var y: T; @@ -32,7 +32,7 @@ class Point(T:! Number) { external impl i32 as Number { fn Zero() -> i32 { return 0; } - fn Add[self: i32](other: i32) -> i32 { return self + other; } + fn Add[me: i32](other: i32) -> i32 { return me + other; } } fn Main() -> i32 { diff --git a/explorer/testdata/generic_class/use_self.carbon b/explorer/testdata/generic_class/use_self.carbon index 9985fb1ea8a74..9f7544d59a250 100644 --- a/explorer/testdata/generic_class/use_self.carbon +++ b/explorer/testdata/generic_class/use_self.carbon @@ -17,8 +17,8 @@ class Point(T:! Type) { return {.x = zero, .y = zero}; } - fn GetX[self: Self]() -> T { - return self.x; + fn GetX[me: Self]() -> T { + return me.x; } var x: T; diff --git a/explorer/testdata/generic_function/generic_method.carbon b/explorer/testdata/generic_function/generic_method.carbon index 6e292fc5b63fc..42e90001cb3e5 100644 --- a/explorer/testdata/generic_function/generic_method.carbon +++ b/explorer/testdata/generic_function/generic_method.carbon @@ -14,13 +14,13 @@ package ExplorerTest api; class Cell(T:! Type) { fn Create(x: T) -> Cell(T) { return { .data = x }; } - fn Get[self: Self]() -> T { - return self.data; + fn Get[me: Self]() -> T { + return me.data; } - fn Put[addr self: Self*](x: T) { - (*self).data = x; + fn Put[addr me: Self*](x: T) { + (*me).data = x; } - fn CreateOther[self: Self, U:! Type](x: U) -> Cell(U) { + fn CreateOther[me: Self, U:! Type](x: U) -> Cell(U) { return {.data = x}; } var data: T; diff --git a/explorer/testdata/generic_function/implicit_conversion.carbon b/explorer/testdata/generic_function/implicit_conversion.carbon index e08ca3a1e2283..ad6ee0025e8e2 100644 --- a/explorer/testdata/generic_function/implicit_conversion.carbon +++ b/explorer/testdata/generic_function/implicit_conversion.carbon @@ -12,10 +12,10 @@ package ExplorerTest api; interface IntLike { - fn Convert[self: Self]() -> i32; + fn Convert[me: Self]() -> i32; } impl i32 as IntLike { - fn Convert[self: i32]() -> i32 { return self; } + fn Convert[me: i32]() -> i32 { return me; } } fn add[T:! IntLike](x: {.a: T, .b: ({.m: i32, .n: T}, i32)}) -> i32 { diff --git a/explorer/testdata/global_variable/implicit_conversion.carbon b/explorer/testdata/global_variable/implicit_conversion.carbon index 89998f28134b2..7114330d90588 100644 --- a/explorer/testdata/global_variable/implicit_conversion.carbon +++ b/explorer/testdata/global_variable/implicit_conversion.carbon @@ -15,7 +15,7 @@ class A { var n: i32; } impl i32 as ImplicitAs(A) { - fn Convert[self: Self]() -> A { return {.n = self}; } + fn Convert[me: Self]() -> A { return {.n = me}; } } var a: A = 5; diff --git a/explorer/testdata/if_else/convert_condition.carbon b/explorer/testdata/if_else/convert_condition.carbon index 2f64880373a03..44c8d7e160e80 100644 --- a/explorer/testdata/if_else/convert_condition.carbon +++ b/explorer/testdata/if_else/convert_condition.carbon @@ -15,8 +15,8 @@ class LazyEq { var v1: i32; var v2: i32; impl as ImplicitAs(Bool) { - fn Convert[self: Self]() -> Bool { - return self.v1 == self.v2; + fn Convert[me: Self]() -> Bool { + return me.v1 == me.v2; } } fn Make(v1: i32, v2: i32) -> Self { diff --git a/explorer/testdata/if_expression/convert_condition.carbon b/explorer/testdata/if_expression/convert_condition.carbon index c9f3b4610d4dd..34c0337747bcc 100644 --- a/explorer/testdata/if_expression/convert_condition.carbon +++ b/explorer/testdata/if_expression/convert_condition.carbon @@ -15,8 +15,8 @@ class LazyEq { var v1: i32; var v2: i32; impl as ImplicitAs(Bool) { - fn Convert[self: Self]() -> Bool { - return self.v1 == self.v2; + fn Convert[me: Self]() -> Bool { + return me.v1 == me.v2; } } fn Make(v1: i32, v2: i32) -> Self { diff --git a/explorer/testdata/impl/fail_ambiguous_impl.carbon b/explorer/testdata/impl/fail_ambiguous_impl.carbon index fb6eec6e9f671..3a21ceda258e6 100644 --- a/explorer/testdata/impl/fail_ambiguous_impl.carbon +++ b/explorer/testdata/impl/fail_ambiguous_impl.carbon @@ -12,8 +12,8 @@ package ExplorerTest api; interface Vector { - fn Add[self: Self](b: Self) -> Self; - fn Scale[self: Self](v: i32) -> Self; + fn Add[me: Self](b: Self) -> Self; + fn Scale[me: Self](v: i32) -> Self; } class Point { @@ -22,20 +22,20 @@ class Point { } external impl Point as Vector { - fn Add[self: Point](b: Point) -> Point { - return {.x = self.x + b.x, .y = self.y + b.y}; + fn Add[me: Point](b: Point) -> Point { + return {.x = me.x + b.x, .y = me.y + b.y}; } - fn Scale[self: Point](v: i32) -> Point { - return {.x = self.x * v, .y = self.y * v}; + fn Scale[me: Point](v: i32) -> Point { + return {.x = me.x * v, .y = me.y * v}; } } external impl Point as Vector { - fn Add[self: Point](b: Point) -> Point { - return {.x = self.x + b.x, .y = self.y + b.y}; + fn Add[me: Point](b: Point) -> Point { + return {.x = me.x + b.x, .y = me.y + b.y}; } - fn Scale[self: Point](v: i32) -> Point { - return {.x = self.x * v, .y = self.y * v}; + fn Scale[me: Point](v: i32) -> Point { + return {.x = me.x * v, .y = me.y * v}; } // CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/impl/fail_ambiguous_impl.carbon:[[@LINE+1]]: ambiguous implementations of interface Vector for class Point } diff --git a/explorer/testdata/impl/fail_unambiguous_impl_generic.carbon b/explorer/testdata/impl/fail_unambiguous_impl_generic.carbon index c72f0deba535c..482048b46e62d 100644 --- a/explorer/testdata/impl/fail_unambiguous_impl_generic.carbon +++ b/explorer/testdata/impl/fail_unambiguous_impl_generic.carbon @@ -11,8 +11,8 @@ package ExplorerTest api; interface Vector(T:! Type) { - fn Add[self: Self](b: Self) -> Self; - fn Scale[self: Self](v: T) -> Self; + fn Add[me: Self](b: Self) -> Self; + fn Scale[me: Self](v: T) -> Self; } class Point(T:! Type) { @@ -21,20 +21,20 @@ class Point(T:! Type) { } external impl Point(i32) as Vector(i32) { - fn Add[self: Self](b: Self) -> Self { - return {.x = self.x + b.x, .y = self.y + b.y}; + fn Add[me: Self](b: Self) -> Self { + return {.x = me.x + b.x, .y = me.y + b.y}; } - fn Scale[self: Self](v: i32) -> Self { - return {.x = self.x * v, .y = self.y * v}; + fn Scale[me: Self](v: i32) -> Self { + return {.x = me.x * v, .y = me.y * v}; } } external impl forall [T:! Type] Point(T) as Vector(T) { - fn Add[self: Self](b: Self) -> Self { - return self; + fn Add[me: Self](b: Self) -> Self { + return me; } - fn Scale[self: Self](v: T) -> Self { - return self; + fn Scale[me: Self](v: T) -> Self { + return me; } } diff --git a/explorer/testdata/impl/generic_method_impl.carbon b/explorer/testdata/impl/generic_method_impl.carbon index 8e7a893821672..01d6005099279 100644 --- a/explorer/testdata/impl/generic_method_impl.carbon +++ b/explorer/testdata/impl/generic_method_impl.carbon @@ -14,16 +14,16 @@ package ExplorerTest api; class Cell(T:! Type) { fn Create(x: T) -> Cell(T) { return { .data = x }; } - fn Get[self: Self]() -> T { - return self.data; + fn Get[me: Self]() -> T { + return me.data; } - fn Put[addr self: Self*](x: T) { - (*self).data = x; + fn Put[addr me: Self*](x: T) { + (*me).data = x; } - fn Update[addr self: Self*, U:! ImplicitAs(T)](x: U) { - (*self).data = x; + fn Update[addr me: Self*, U:! ImplicitAs(T)](x: U) { + (*me).data = x; } - fn CreateOther[self: Self, U:! Type](x: U) -> Cell(U) { + fn CreateOther[me: Self, U:! Type](x: U) -> Cell(U) { return {.data = x}; } var data: T; diff --git a/explorer/testdata/impl/impl_in_generic_class.carbon b/explorer/testdata/impl/impl_in_generic_class.carbon index 3e61634bd9485..94e2f2959d32b 100644 --- a/explorer/testdata/impl/impl_in_generic_class.carbon +++ b/explorer/testdata/impl/impl_in_generic_class.carbon @@ -12,12 +12,12 @@ package ExplorerTest api; interface I(T:! Type) { - fn F[self: Self](t: T, o: Self) -> Self; + fn F[me: Self](t: T, o: Self) -> Self; } class X(U:! Type) { impl as I(U) { - fn F[self: Self](u: U, o: Self) -> Self { return {.m = u, .n = self.n + o.n}; } + fn F[me: Self](u: U, o: Self) -> Self { return {.m = u, .n = me.n + o.n}; } } var m: U; var n: i32; diff --git a/explorer/testdata/impl/param_impl.carbon b/explorer/testdata/impl/param_impl.carbon index af6885c2a01d9..4b67ef17c222b 100644 --- a/explorer/testdata/impl/param_impl.carbon +++ b/explorer/testdata/impl/param_impl.carbon @@ -13,7 +13,7 @@ package ExplorerTest api; interface Number { fn Zero() -> Self; - fn Add[self: Self](other: Self) -> Self; + fn Add[me: Self](other: Self) -> Self; } class Point(T:! Number) { @@ -23,13 +23,13 @@ class Point(T:! Number) { external impl i32 as Number { fn Zero() -> i32 { return 0; } - fn Add[self: i32](other: i32) -> i32 { return self + other; } + fn Add[me: i32](other: i32) -> i32 { return me + other; } } external impl forall [U:! Number] Point(U) as Number { fn Zero() -> Point(U) { return {.x = U.Zero(), .y = U.Zero() }; } - fn Add[self: Point(U)](other: Point(U)) -> Point(U) { - return {.x = self.x.Add(other.x), .y = self.y.Add(other.y)}; + fn Add[me: Point(U)](other: Point(U)) -> Point(U) { + return {.x = me.x.Add(other.x), .y = me.y.Add(other.y)}; } } diff --git a/explorer/testdata/impl/param_impl2.carbon b/explorer/testdata/impl/param_impl2.carbon index 9708ad29a62ae..26fd213da650a 100644 --- a/explorer/testdata/impl/param_impl2.carbon +++ b/explorer/testdata/impl/param_impl2.carbon @@ -13,7 +13,7 @@ package ExplorerTest api; interface Number { fn Zero() -> Self; - fn Add[self: Self](other: Self) -> Self; + fn Add[me: Self](other: Self) -> Self; } class Point(T:! Number) { @@ -23,13 +23,13 @@ class Point(T:! Number) { external impl i32 as Number { fn Zero() -> i32 { return 0; } - fn Add[self: i32](other: i32) -> i32 { return self + other; } + fn Add[me: i32](other: i32) -> i32 { return me + other; } } external impl forall [U:! Number] Point(U) as Number { fn Zero() -> Point(U) { return {.x = U.Zero(), .y = U.Zero() }; } - fn Add[self: Point(U)](other: Point(U)) -> Point(U) { - return {.x = self.x.Add(other.x), .y = self.y.Add(other.y)}; + fn Add[me: Point(U)](other: Point(U)) -> Point(U) { + return {.x = me.x.Add(other.x), .y = me.y.Add(other.y)}; } } diff --git a/explorer/testdata/impl/param_impl_with_self.carbon b/explorer/testdata/impl/param_impl_with_self.carbon index d3975649da0b8..8a5e8f5e49888 100644 --- a/explorer/testdata/impl/param_impl_with_self.carbon +++ b/explorer/testdata/impl/param_impl_with_self.carbon @@ -13,7 +13,7 @@ package ExplorerTest api; interface Number { fn Zero() -> Self; - fn Add[self: Self](other: Self) -> Self; + fn Add[me: Self](other: Self) -> Self; } class Point(T:! Number) { @@ -23,14 +23,14 @@ class Point(T:! Number) { external impl i32 as Number { fn Zero() -> i32 { return 0; } - fn Add[self: i32](other: i32) -> i32 { return self + other; } + fn Add[me: i32](other: i32) -> i32 { return me + other; } } external impl forall [U:! Number] Point(U) as Number { // Allowed: `Self` means `Point(U)` here. fn Zero() -> Self { return {.x = U.Zero(), .y = U.Zero() }; } - fn Add[self: Self](other: Self) -> Self { - return {.x = self.x.Add(other.x), .y = self.y.Add(other.y)}; + fn Add[me: Self](other: Self) -> Self { + return {.x = me.x.Add(other.x), .y = me.y.Add(other.y)}; } } diff --git a/explorer/testdata/interface/class_function.carbon b/explorer/testdata/interface/class_function.carbon index 44d6262d86d92..9a27bc26c43d9 100644 --- a/explorer/testdata/interface/class_function.carbon +++ b/explorer/testdata/interface/class_function.carbon @@ -13,8 +13,8 @@ package ExplorerTest api; interface Vector { fn Zero() -> Self; - fn Add[self: Self](b: Self) -> Self; - fn Scale[self: Self](v: i32) -> Self; + fn Add[me: Self](b: Self) -> Self; + fn Scale[me: Self](v: i32) -> Self; } class Point { @@ -24,11 +24,11 @@ class Point { fn Zero() -> Point { return {.x = 0, .y = 0}; } - fn Add[self: Point](b: Point) -> Point { - return {.x = self.x + b.x, .y = self.y + b.y}; + fn Add[me: Point](b: Point) -> Point { + return {.x = me.x + b.x, .y = me.y + b.y}; } - fn Scale[self: Point](v: i32) -> Point { - return {.x = self.x * v, .y = self.y * v}; + fn Scale[me: Point](v: i32) -> Point { + return {.x = me.x * v, .y = me.y * v}; } } } diff --git a/explorer/testdata/interface/constrained_parameter.carbon b/explorer/testdata/interface/constrained_parameter.carbon index 5608e2b1ff149..e6b3a747e5907 100644 --- a/explorer/testdata/interface/constrained_parameter.carbon +++ b/explorer/testdata/interface/constrained_parameter.carbon @@ -12,16 +12,16 @@ package ExplorerTest api; interface AddMul { - fn Add[self: Self](o: Self) -> Self; - fn Mul[self: Self](o: Self) -> Self; + fn Add[me: Self](o: Self) -> Self; + fn Mul[me: Self](o: Self) -> Self; } external impl i32 as AddMul { - fn Add[self: i32](o: i32) -> i32 { - return self + o; + fn Add[me: i32](o: i32) -> i32 { + return me + o; } - fn Mul[self: i32](o: i32) -> i32 { - return self * o; + fn Mul[me: i32](o: i32) -> i32 { + return me * o; } } @@ -31,9 +31,9 @@ class Holder(T:! AddMul) { interface Vector(Scalar:! AddMul) { fn Zero() -> Self; - fn Add[self: Self](b: Self) -> Self; - fn Scale[self: Self](v: Scalar) -> Self; - fn Hold[self: Self](v: Scalar) -> Holder(Scalar); + fn Add[me: Self](b: Self) -> Self; + fn Scale[me: Self](v: Scalar) -> Self; + fn Hold[me: Self](v: Scalar) -> Holder(Scalar); } class Point { @@ -43,13 +43,13 @@ class Point { fn Zero() -> Point { return {.x = 0, .y = 0}; } - fn Add[self: Point](b: Point) -> Point { - return {.x = self.x + b.x, .y = self.y + b.y}; + fn Add[me: Point](b: Point) -> Point { + return {.x = me.x + b.x, .y = me.y + b.y}; } - fn Scale[self: Point](v: i32) -> Point { - return {.x = self.x * v, .y = self.y * v}; + fn Scale[me: Point](v: i32) -> Point { + return {.x = me.x * v, .y = me.y * v}; } - fn Hold[self: Point](v: i32) -> Holder(i32) { + fn Hold[me: Point](v: i32) -> Holder(i32) { return {.v = v}; } } diff --git a/explorer/testdata/interface/external_impl_point_vector.carbon b/explorer/testdata/interface/external_impl_point_vector.carbon index 0d2788602d82c..143ad3df2dc29 100644 --- a/explorer/testdata/interface/external_impl_point_vector.carbon +++ b/explorer/testdata/interface/external_impl_point_vector.carbon @@ -12,8 +12,8 @@ package ExplorerTest api; interface Vector { - fn Add[self: Self](b: Self) -> Self; - fn Scale[self: Self](v: i32) -> Self; + fn Add[me: Self](b: Self) -> Self; + fn Scale[me: Self](v: i32) -> Self; } class Point { @@ -22,11 +22,11 @@ class Point { } external impl Point as Vector { - fn Add[self: Point](b: Point) -> Point { - return {.x = self.x + b.x, .y = self.y + b.y}; + fn Add[me: Point](b: Point) -> Point { + return {.x = me.x + b.x, .y = me.y + b.y}; } - fn Scale[self: Point](v: i32) -> Point { - return {.x = self.x * v, .y = self.y * v}; + fn Scale[me: Point](v: i32) -> Point { + return {.x = me.x * v, .y = me.y * v}; } } diff --git a/explorer/testdata/interface/external_impl_use_self.carbon b/explorer/testdata/interface/external_impl_use_self.carbon index 8a0513c2332dc..cff62cf76d9f4 100644 --- a/explorer/testdata/interface/external_impl_use_self.carbon +++ b/explorer/testdata/interface/external_impl_use_self.carbon @@ -12,8 +12,8 @@ package ExplorerTest api; interface Vector { - fn Add[self: Self](b: Self) -> Self; - fn Scale[self: Self](v: i32) -> Self; + fn Add[me: Self](b: Self) -> Self; + fn Scale[me: Self](v: i32) -> Self; } class Point { @@ -23,11 +23,11 @@ class Point { external impl Point as Vector { // Allowed: `Self` means `Point` here. - fn Add[self: Self](b: Self) -> Self { - return {.x = self.x + b.x, .y = self.y + b.y}; + fn Add[me: Self](b: Self) -> Self { + return {.x = me.x + b.x, .y = me.y + b.y}; } - fn Scale[self: Self](v: i32) -> Self { - return {.x = self.x * v, .y = self.y * v}; + fn Scale[me: Self](v: i32) -> Self { + return {.x = me.x * v, .y = me.y * v}; } } diff --git a/explorer/testdata/interface/fail_external_impl_omit_self.carbon b/explorer/testdata/interface/fail_external_impl_omit_self.carbon index bdab0dafc0c32..b4fb2e34fa1d6 100644 --- a/explorer/testdata/interface/fail_external_impl_omit_self.carbon +++ b/explorer/testdata/interface/fail_external_impl_omit_self.carbon @@ -11,8 +11,8 @@ package ExplorerTest api; interface Vector { - fn Add[self: Self](b: Self) -> Self; - fn Scale[self: Self](v: i32) -> Self; + fn Add[me: Self](b: Self) -> Self; + fn Scale[me: Self](v: i32) -> Self; } class Point { @@ -23,11 +23,11 @@ class Point { // Error: need to specify which type implementing `Vector` for. // CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/interface/fail_external_impl_omit_self.carbon:[[@LINE+1]]: could not resolve 'Self' external impl as Vector { - fn Add[self: Point](b: Point) -> Point { - return {.x = self.x + b.x, .y = self.y + b.y}; + fn Add[me: Point](b: Point) -> Point { + return {.x = me.x + b.x, .y = me.y + b.y}; } - fn Scale[self: Point](v: i32) -> Point { - return {.x = self.x * v, .y = self.y * v}; + fn Scale[me: Point](v: i32) -> Point { + return {.x = me.x * v, .y = me.y * v}; } } diff --git a/explorer/testdata/interface/fail_external_impl_self.carbon b/explorer/testdata/interface/fail_external_impl_self.carbon index 4ee93a93fb132..84946129165ca 100644 --- a/explorer/testdata/interface/fail_external_impl_self.carbon +++ b/explorer/testdata/interface/fail_external_impl_self.carbon @@ -11,8 +11,8 @@ package ExplorerTest api; interface Vector { - fn Add[self: Self](b: Self) -> Self; - fn Scale[self: Self](v: i32) -> Self; + fn Add[me: Self](b: Self) -> Self; + fn Scale[me: Self](v: i32) -> Self; } class Point { @@ -22,11 +22,11 @@ class Point { // CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/interface/fail_external_impl_self.carbon:[[@LINE+1]]: could not resolve 'Self' external impl Self as Vector { - fn Add[self: Point](b: Point) -> Point { - return {.x = self.x + b.x, .y = self.y + b.y}; + fn Add[me: Point](b: Point) -> Point { + return {.x = me.x + b.x, .y = me.y + b.y}; } - fn Scale[self: Point](v: i32) -> Point { - return {.x = self.x * v, .y = self.y * v}; + fn Scale[me: Point](v: i32) -> Point { + return {.x = me.x * v, .y = me.y * v}; } } diff --git a/explorer/testdata/interface/fail_impl_bad_member.carbon b/explorer/testdata/interface/fail_impl_bad_member.carbon index 507c4f11b7081..65d769f7d801b 100644 --- a/explorer/testdata/interface/fail_impl_bad_member.carbon +++ b/explorer/testdata/interface/fail_impl_bad_member.carbon @@ -11,18 +11,18 @@ package ExplorerTest api; interface Vector { - fn Add[self: Self](b: Self) -> Self; - fn Scale[self: Self](v: i32) -> Self; + fn Add[me: Self](b: Self) -> Self; + fn Scale[me: Self](v: i32) -> Self; } class Point { var x: i32; var y: i32; impl Point as Vector { - fn Add[self: Point](b: Point) -> Point { - return {.x = self.x + b.x, .y = self.y + b.y}; + fn Add[me: Point](b: Point) -> Point { + return {.x = me.x + b.x, .y = me.y + b.y}; } - fn Scale[self: Point](v: i32) -> i32 { + fn Scale[me: Point](v: i32) -> i32 { return 0; // CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/interface/fail_impl_bad_member.carbon:[[@LINE+3]]: type error in member of implementation // CHECK: expected: fn (i32) -> class Point diff --git a/explorer/testdata/interface/fail_impl_missing_member.carbon b/explorer/testdata/interface/fail_impl_missing_member.carbon index 60b8c711f204b..4d7b419e828b0 100644 --- a/explorer/testdata/interface/fail_impl_missing_member.carbon +++ b/explorer/testdata/interface/fail_impl_missing_member.carbon @@ -11,16 +11,16 @@ package ExplorerTest api; interface Vector { - fn Add[self: Self](b: Self) -> Self; - fn Scale[self: Self](v: i32) -> Self; + fn Add[me: Self](b: Self) -> Self; + fn Scale[me: Self](v: i32) -> Self; } class Point { var x: i32; var y: i32; impl Point as Vector { - fn Add[self: Point](b: Point) -> Point { - return {.x = self.x + b.x, .y = self.y + b.y}; + fn Add[me: Point](b: Point) -> Point { + return {.x = me.x + b.x, .y = me.y + b.y}; } // CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/interface/fail_impl_missing_member.carbon:[[@LINE+1]]: implementation missing Scale } diff --git a/explorer/testdata/interface/fail_interface_missing_member.carbon b/explorer/testdata/interface/fail_interface_missing_member.carbon index 607bcff20b4c9..14bbe7fb0a469 100644 --- a/explorer/testdata/interface/fail_interface_missing_member.carbon +++ b/explorer/testdata/interface/fail_interface_missing_member.carbon @@ -11,7 +11,7 @@ package ExplorerTest api; interface Vector { - fn Add[self: Self](b: Self) -> Self; + fn Add[me: Self](b: Self) -> Self; } fn ScaleGeneric[T:! Vector](a: T, s: i32) -> T { @@ -23,8 +23,8 @@ class Point { var x: i32; var y: i32; impl Point as Vector { - fn Add[self: Point](b: Point) -> Point { - return {.x = self.x + b.x, .y = self.y + b.y}; + fn Add[me: Point](b: Point) -> Point { + return {.x = me.x + b.x, .y = me.y + b.y}; } } } diff --git a/explorer/testdata/interface/fail_no_impl.carbon b/explorer/testdata/interface/fail_no_impl.carbon index cf91361890d87..db752f278856a 100644 --- a/explorer/testdata/interface/fail_no_impl.carbon +++ b/explorer/testdata/interface/fail_no_impl.carbon @@ -11,8 +11,8 @@ package ExplorerTest api; interface Vector { - fn Add[self: Self](b: Self) -> Self; - fn Scale[self: Self](v: i32) -> Self; + fn Add[me: Self](b: Self) -> Self; + fn Scale[me: Self](v: i32) -> Self; } class Point { diff --git a/explorer/testdata/interface/generic_call_generic.carbon b/explorer/testdata/interface/generic_call_generic.carbon index c30dafac8a953..9a016f1dbe0f8 100644 --- a/explorer/testdata/interface/generic_call_generic.carbon +++ b/explorer/testdata/interface/generic_call_generic.carbon @@ -12,19 +12,19 @@ package ExplorerTest api; interface Vector { - fn Add[self: Self](b: Self) -> Self; - fn Scale[self: Self](v: i32) -> Self; + fn Add[me: Self](b: Self) -> Self; + fn Scale[me: Self](v: i32) -> Self; } class Point { var x: i32; var y: i32; impl Point as Vector { - fn Add[self: Point](b: Point) -> Point { - return {.x = self.x + b.x, .y = self.y + b.y}; + fn Add[me: Point](b: Point) -> Point { + return {.x = me.x + b.x, .y = me.y + b.y}; } - fn Scale[self: Point](v: i32) -> Point { - return {.x = self.x * v, .y = self.y * v}; + fn Scale[me: Point](v: i32) -> Point { + return {.x = me.x * v, .y = me.y * v}; } } } diff --git a/explorer/testdata/interface/generic_with_two_params.carbon b/explorer/testdata/interface/generic_with_two_params.carbon index 8b49e7ae646a6..ac50395ee781f 100644 --- a/explorer/testdata/interface/generic_with_two_params.carbon +++ b/explorer/testdata/interface/generic_with_two_params.carbon @@ -12,19 +12,19 @@ package ExplorerTest api; interface Vector { - fn Add[self: Self](b: Self) -> Self; - fn Scale[self: Self](v: i32) -> Self; + fn Add[me: Self](b: Self) -> Self; + fn Scale[me: Self](v: i32) -> Self; } class Point1 { var x: i32; var y: i32; impl Point1 as Vector { - fn Add[self: Point1](b: Point1) -> Point1 { - return {.x = self.x + b.x, .y = self.y + b.y}; + fn Add[me: Point1](b: Point1) -> Point1 { + return {.x = me.x + b.x, .y = me.y + b.y}; } - fn Scale[self: Point1](v: i32) -> Point1 { - return {.x = self.x * v, .y = self.y * v}; + fn Scale[me: Point1](v: i32) -> Point1 { + return {.x = me.x * v, .y = me.y * v}; } } } @@ -33,11 +33,11 @@ class Point2 { var x: i32; var y: i32; impl Point2 as Vector { - fn Add[self: Point2](b: Point2) -> Point2 { - return {.x = self.x + b.x + 1, .y = self.y + b.y + 1}; + fn Add[me: Point2](b: Point2) -> Point2 { + return {.x = me.x + b.x + 1, .y = me.y + b.y + 1}; } - fn Scale[self: Point2](v: i32) -> Point2 { - return {.x = self.x * v * 2, .y = self.y * v * 2}; + fn Scale[me: Point2](v: i32) -> Point2 { + return {.x = me.x * v * 2, .y = me.y * v * 2}; } } } diff --git a/explorer/testdata/interface/impl_self_interface_parameter.carbon b/explorer/testdata/interface/impl_self_interface_parameter.carbon index 998d674af058e..985dfbfc0977b 100644 --- a/explorer/testdata/interface/impl_self_interface_parameter.carbon +++ b/explorer/testdata/interface/impl_self_interface_parameter.carbon @@ -12,7 +12,7 @@ package ExplorerTest api; interface AddWith(T:! Type) { - fn Op[self: Self](b: T) -> Self; + fn Op[me: Self](b: T) -> Self; } class Point { @@ -22,8 +22,8 @@ class Point { // Allowed: `Self` means `Point` after `as` impl Point as AddWith(Self) { - fn Op[self: Point](b: Point) -> Point { - return {.x = self.x + b.x, .y = self.y + b.y}; + fn Op[me: Point](b: Point) -> Point { + return {.x = me.x + b.x, .y = me.y + b.y}; } } diff --git a/explorer/testdata/interface/omit_self.carbon b/explorer/testdata/interface/omit_self.carbon index b311da009f057..32db2d5ae0f49 100644 --- a/explorer/testdata/interface/omit_self.carbon +++ b/explorer/testdata/interface/omit_self.carbon @@ -13,8 +13,8 @@ package ExplorerTest api; interface Vector { fn Zero() -> Self; - fn Add[self: Self](b: Self) -> Self; - fn Scale[self: Self](v: i32) -> Self; + fn Add[me: Self](b: Self) -> Self; + fn Scale[me: Self](v: i32) -> Self; } class Point { @@ -26,11 +26,11 @@ class Point { fn Zero() -> Point { return {.x = 0, .y = 0}; } - fn Add[self: Point](b: Point) -> Point { - return {.x = self.x + b.x, .y = self.y + b.y}; + fn Add[me: Point](b: Point) -> Point { + return {.x = me.x + b.x, .y = me.y + b.y}; } - fn Scale[self: Point](v: i32) -> Point { - return {.x = self.x * v, .y = self.y * v}; + fn Scale[me: Point](v: i32) -> Point { + return {.x = me.x * v, .y = me.y * v}; } } } diff --git a/explorer/testdata/interface/param_with_dependent_type.carbon b/explorer/testdata/interface/param_with_dependent_type.carbon index 8d2db664b81d7..e8ffa9e656277 100644 --- a/explorer/testdata/interface/param_with_dependent_type.carbon +++ b/explorer/testdata/interface/param_with_dependent_type.carbon @@ -12,11 +12,11 @@ package ExplorerTest api; interface HasValueParam(T:! Type, V:! T) { - fn Go[self: Self]() -> T; + fn Go[me: Self]() -> T; } impl () as HasValueParam(i32, 5) { - fn Go[self: Self]() -> i32 { return 42; } + fn Go[me: Self]() -> i32 { return 42; } } fn Main() -> i32 { diff --git a/explorer/testdata/interface/parameterized.carbon b/explorer/testdata/interface/parameterized.carbon index fdd69383c4ddf..c66d1cc716527 100644 --- a/explorer/testdata/interface/parameterized.carbon +++ b/explorer/testdata/interface/parameterized.carbon @@ -13,8 +13,8 @@ package ExplorerTest api; interface Vector(Scalar:! Type) { fn Zero() -> Self; - fn Add[self: Self](b: Self) -> Self; - fn Scale[self: Self](v: Scalar) -> Self; + fn Add[me: Self](b: Self) -> Self; + fn Scale[me: Self](v: Scalar) -> Self; } class Point { @@ -24,11 +24,11 @@ class Point { fn Zero() -> Point { return {.x = 0, .y = 0}; } - fn Add[self: Point](b: Point) -> Point { - return {.x = self.x + b.x, .y = self.y + b.y}; + fn Add[me: Point](b: Point) -> Point { + return {.x = me.x + b.x, .y = me.y + b.y}; } - fn Scale[self: Point](v: i32) -> Point { - return {.x = self.x * v, .y = self.y * v}; + fn Scale[me: Point](v: i32) -> Point { + return {.x = me.x * v, .y = me.y * v}; } } } diff --git a/explorer/testdata/interface/tuple_vector_add_scale.carbon b/explorer/testdata/interface/tuple_vector_add_scale.carbon index ff40238df343f..35f6294685f6e 100644 --- a/explorer/testdata/interface/tuple_vector_add_scale.carbon +++ b/explorer/testdata/interface/tuple_vector_add_scale.carbon @@ -12,19 +12,19 @@ package ExplorerTest api; interface Vector { - fn Add[self: Self](b: Self) -> Self; - fn Scale[self: Self](v: i32) -> Self; + fn Add[me: Self](b: Self) -> Self; + fn Scale[me: Self](v: i32) -> Self; } class Point { var x: i32; var y: i32; impl Point as Vector { - fn Add[self: Point](b: Point) -> Point { - return {.x = self.x + b.x, .y = self.y + b.y}; + fn Add[me: Point](b: Point) -> Point { + return {.x = me.x + b.x, .y = me.y + b.y}; } - fn Scale[self: Point](v: i32) -> Point { - return {.x = self.x * v, .y = self.y * v}; + fn Scale[me: Point](v: i32) -> Point { + return {.x = me.x * v, .y = me.y * v}; } } } diff --git a/explorer/testdata/interface/vector_point_add_scale.carbon b/explorer/testdata/interface/vector_point_add_scale.carbon index 4db8e25457df5..961b19c713604 100644 --- a/explorer/testdata/interface/vector_point_add_scale.carbon +++ b/explorer/testdata/interface/vector_point_add_scale.carbon @@ -12,19 +12,19 @@ package ExplorerTest api; interface Vector { - fn Add[self: Self](b: Self) -> Self; - fn Scale[self: Self](v: i32) -> Self; + fn Add[me: Self](b: Self) -> Self; + fn Scale[me: Self](v: i32) -> Self; } class Point { var x: i32; var y: i32; impl Point as Vector { - fn Add[self: Point](b: Point) -> Point { - return {.x = self.x + b.x, .y = self.y + b.y}; + fn Add[me: Point](b: Point) -> Point { + return {.x = me.x + b.x, .y = me.y + b.y}; } - fn Scale[self: Point](v: i32) -> Point { - return {.x = self.x * v, .y = self.y * v}; + fn Scale[me: Point](v: i32) -> Point { + return {.x = me.x * v, .y = me.y * v}; } } } diff --git a/explorer/testdata/interface/with_self.carbon b/explorer/testdata/interface/with_self.carbon index b94ad83fa67ae..95c49ea532f86 100644 --- a/explorer/testdata/interface/with_self.carbon +++ b/explorer/testdata/interface/with_self.carbon @@ -13,8 +13,8 @@ package ExplorerTest api; interface Vector { fn Zero() -> Self; - fn Add[self: Self](b: Self) -> Self; - fn Scale[self: Self](v: i32) -> Self; + fn Add[me: Self](b: Self) -> Self; + fn Scale[me: Self](v: i32) -> Self; } class Point { @@ -25,11 +25,11 @@ class Point { fn Zero() -> Self { return {.x = 0, .y = 0}; } - fn Add[self: Self](b: Self) -> Self { - return {.x = self.x + b.x, .y = self.y + b.y}; + fn Add[me: Self](b: Self) -> Self { + return {.x = me.x + b.x, .y = me.y + b.y}; } - fn Scale[self: Self](v: i32) -> Self { - return {.x = self.x * v, .y = self.y * v}; + fn Scale[me: Self](v: i32) -> Self { + return {.x = me.x * v, .y = me.y * v}; } } } diff --git a/explorer/testdata/let/fail_method_args.carbon b/explorer/testdata/let/fail_method_args.carbon index 2c2f679891565..f0c36a058a572 100644 --- a/explorer/testdata/let/fail_method_args.carbon +++ b/explorer/testdata/let/fail_method_args.carbon @@ -15,7 +15,7 @@ class Point { return {.x = 0, .y = 0}; } - fn SetX[self: Point](x: i32) { + fn SetX[me: Point](x: i32) { // CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/let/fail_method_args.carbon:[[@LINE+1]]: Cannot assign to rvalue 'x' x = 10; } diff --git a/explorer/testdata/let/implicit_conversion.carbon b/explorer/testdata/let/implicit_conversion.carbon index f6bb168bbf4c3..c6974d493109b 100644 --- a/explorer/testdata/let/implicit_conversion.carbon +++ b/explorer/testdata/let/implicit_conversion.carbon @@ -13,7 +13,7 @@ package ExplorerTest api; class A { impl as ImplicitAs(i32) { - fn Convert[self: Self]() -> i32 { return self.n; } + fn Convert[me: Self]() -> i32 { return me.n; } } var n: i32; } diff --git a/explorer/testdata/let/implicit_conversion_choice.carbon b/explorer/testdata/let/implicit_conversion_choice.carbon index ca7370618cfc3..3cc2864a8fe5f 100644 --- a/explorer/testdata/let/implicit_conversion_choice.carbon +++ b/explorer/testdata/let/implicit_conversion_choice.carbon @@ -16,7 +16,7 @@ choice A { } impl i32 as ImplicitAs(A) { - fn Convert[self: Self]() -> A { return A.Value(self + 1); } + fn Convert[me: Self]() -> A { return A.Value(me + 1); } } fn Main() -> i32 { diff --git a/explorer/testdata/match/convert.carbon b/explorer/testdata/match/convert.carbon index 28acd1d73fa00..631aad4cf6695 100644 --- a/explorer/testdata/match/convert.carbon +++ b/explorer/testdata/match/convert.carbon @@ -13,7 +13,7 @@ package ExplorerTest api; class A {} impl A as ImplicitAs(i32) { - fn Convert[self: Self]() -> i32 { return 1; } + fn Convert[me: Self]() -> i32 { return 1; } } fn Main() -> i32 { diff --git a/explorer/testdata/match/fail_pattern_type_mismatch.carbon b/explorer/testdata/match/fail_pattern_type_mismatch.carbon index ec0b34f7a38a9..49b620e1e7eb2 100644 --- a/explorer/testdata/match/fail_pattern_type_mismatch.carbon +++ b/explorer/testdata/match/fail_pattern_type_mismatch.carbon @@ -12,7 +12,7 @@ package ExplorerTest api; class A {} impl A as ImplicitAs(i32) { - fn Convert[self: Self]() -> i32 { return 1; } + fn Convert[me: Self]() -> i32 { return 1; } } fn Main() -> i32 { diff --git a/explorer/testdata/member_access/convert_lhs_class.carbon b/explorer/testdata/member_access/convert_lhs_class.carbon index 9fc998b7bfef3..29c74a36e464e 100644 --- a/explorer/testdata/member_access/convert_lhs_class.carbon +++ b/explorer/testdata/member_access/convert_lhs_class.carbon @@ -12,14 +12,14 @@ package Foo api; class X { - fn F[self: Self](o: Self) -> Self { return {.n = self.n + o.n}; } + fn F[me: Self](o: Self) -> Self { return {.n = me.n + o.n}; } var n: i32; } class Y { var m: i32; impl as ImplicitAs(X) { - fn Convert[self: Self]() -> X { return {.n = self.m}; } + fn Convert[me: Self]() -> X { return {.n = me.m}; } } } diff --git a/explorer/testdata/member_access/convert_lhs_interface.carbon b/explorer/testdata/member_access/convert_lhs_interface.carbon index d7216a9a8749a..811d3d5cf84f9 100644 --- a/explorer/testdata/member_access/convert_lhs_interface.carbon +++ b/explorer/testdata/member_access/convert_lhs_interface.carbon @@ -12,12 +12,12 @@ package Foo api; interface HasF { - fn F[self: Self](o: Self) -> Self; + fn F[me: Self](o: Self) -> Self; } class X { impl as HasF { - fn F[self: Self](o: Self) -> Self { return {.n = self.n + o.n}; } + fn F[me: Self](o: Self) -> Self { return {.n = me.n + o.n}; } } var n: i32; } @@ -25,7 +25,7 @@ class X { class Y { var m: i32; impl as ImplicitAs(X) { - fn Convert[self: Self]() -> X { return {.n = self.m}; } + fn Convert[me: Self]() -> X { return {.n = me.m}; } } } diff --git a/explorer/testdata/member_access/evaluate_type_before_dot.carbon b/explorer/testdata/member_access/evaluate_type_before_dot.carbon index 48f1ef50666bf..bc3795c3e3856 100644 --- a/explorer/testdata/member_access/evaluate_type_before_dot.carbon +++ b/explorer/testdata/member_access/evaluate_type_before_dot.carbon @@ -18,10 +18,10 @@ package Foo api; choice Choice { Alternative() } class Class { fn F(n: i32) -> i32 { return n + 1; } } -interface Interface { fn G[self: Self]() -> Self; } +interface Interface { fn G[me: Self]() -> Self; } interface AnotherInterface {} -impl i32 as Interface { fn G[self: i32]() -> i32 { return self + 1; } } +impl i32 as Interface { fn G[me: i32]() -> i32 { return me + 1; } } impl i32 as AnotherInterface {} // TODO: These are intended to be called at compile time. Mark them as diff --git a/explorer/testdata/member_access/fail_qualified_non_member.carbon b/explorer/testdata/member_access/fail_qualified_non_member.carbon index d9e2df4fb2633..6252ce58ebe38 100644 --- a/explorer/testdata/member_access/fail_qualified_non_member.carbon +++ b/explorer/testdata/member_access/fail_qualified_non_member.carbon @@ -9,7 +9,7 @@ // AUTOUPDATE: %{explorer} %s package Foo api; -fn F[self: i32]() {} +fn F[me: i32]() {} fn Main() -> i32 { // TODO: It's unclear whether this is valid per the current rules. See // https://github.com/carbon-language/carbon-lang/pull/1122 diff --git a/explorer/testdata/member_access/nearly_vacuous_access_with_instance_binding.carbon b/explorer/testdata/member_access/nearly_vacuous_access_with_instance_binding.carbon index c879f02a77ffe..9cc8cffd78710 100644 --- a/explorer/testdata/member_access/nearly_vacuous_access_with_instance_binding.carbon +++ b/explorer/testdata/member_access/nearly_vacuous_access_with_instance_binding.carbon @@ -10,10 +10,10 @@ // CHECK: result: 1 package Foo api; -interface A { fn F[self: Self]() -> i32; } +interface A { fn F[me: Self]() -> i32; } class X { impl as A { - fn F[self: Self]() -> i32 { return 1; } + fn F[me: Self]() -> i32 { return 1; } } } fn Main() -> i32 { diff --git a/explorer/testdata/member_access/param_qualified_interface_member.carbon b/explorer/testdata/member_access/param_qualified_interface_member.carbon index 11b08adca2135..bfb8f63f810d0 100644 --- a/explorer/testdata/member_access/param_qualified_interface_member.carbon +++ b/explorer/testdata/member_access/param_qualified_interface_member.carbon @@ -11,11 +11,11 @@ package Foo api; interface A { - fn F[self: Self](o: Self) -> Self; + fn F[me: Self](o: Self) -> Self; } class X { impl as A { - fn F[self: Self](o: Self) -> Self { return {.n = self.n + o.n}; } + fn F[me: Self](o: Self) -> Self { return {.n = me.n + o.n}; } } var n: i32; } diff --git a/explorer/testdata/member_access/qualified_class_member.carbon b/explorer/testdata/member_access/qualified_class_member.carbon index bac4da74756cd..c2e16ab4f13ef 100644 --- a/explorer/testdata/member_access/qualified_class_member.carbon +++ b/explorer/testdata/member_access/qualified_class_member.carbon @@ -11,7 +11,7 @@ package Foo api; class X { - fn F[self: Self](o: Self) -> Self { return {.n = self.n + o.n}; } + fn F[me: Self](o: Self) -> Self { return {.n = me.n + o.n}; } var n: i32; } fn Main() -> i32 { diff --git a/explorer/testdata/member_access/qualified_constraint_member.carbon b/explorer/testdata/member_access/qualified_constraint_member.carbon index 2dc393cffe3ba..ed62b95a73987 100644 --- a/explorer/testdata/member_access/qualified_constraint_member.carbon +++ b/explorer/testdata/member_access/qualified_constraint_member.carbon @@ -11,7 +11,7 @@ package Foo api; interface A { - fn F[self: Self]() -> i32; + fn F[me: Self]() -> i32; } interface B { fn G(o: Self) -> i32; @@ -19,7 +19,7 @@ interface B { alias C = A & B; class X { impl as A { - fn F[self: Self]() -> i32 { return 10 * self.n; } + fn F[me: Self]() -> i32 { return 10 * me.n; } } impl as B { fn G(o: Self) -> i32 { return o.n; } diff --git a/explorer/testdata/member_access/qualified_interface_member.carbon b/explorer/testdata/member_access/qualified_interface_member.carbon index 4184271f0a719..77fca174a6f39 100644 --- a/explorer/testdata/member_access/qualified_interface_member.carbon +++ b/explorer/testdata/member_access/qualified_interface_member.carbon @@ -11,11 +11,11 @@ package Foo api; interface A { - fn F[self: Self](o: Self) -> Self; + fn F[me: Self](o: Self) -> Self; } class X { impl as A { - fn F[self: Self](o: Self) -> Self { return {.n = self.n + o.n}; } + fn F[me: Self](o: Self) -> Self { return {.n = me.n + o.n}; } } var n: i32; } diff --git a/explorer/testdata/member_access/qualified_param_member.carbon b/explorer/testdata/member_access/qualified_param_member.carbon index a1fe2727269b8..e3d16d6f94b7c 100644 --- a/explorer/testdata/member_access/qualified_param_member.carbon +++ b/explorer/testdata/member_access/qualified_param_member.carbon @@ -11,11 +11,11 @@ package Foo api; interface A { - fn F[self: Self](o: Self) -> Self; + fn F[me: Self](o: Self) -> Self; } class X { impl as A { - fn F[self: Self](o: Self) -> Self { return {.n = self.n + o.n}; } + fn F[me: Self](o: Self) -> Self { return {.n = me.n + o.n}; } } var n: i32; } diff --git a/explorer/testdata/name_lookup/class_fn_body_reorder.carbon b/explorer/testdata/name_lookup/class_fn_body_reorder.carbon index 33957510e042e..2c7b60869978b 100644 --- a/explorer/testdata/name_lookup/class_fn_body_reorder.carbon +++ b/explorer/testdata/name_lookup/class_fn_body_reorder.carbon @@ -14,11 +14,11 @@ package ExplorerTest api; // The bodies of member functions are processed after all immediately enclosing // classes, impls, and interfaces. class A { - fn F[self: Self]() -> i32 { - return G() + self.H(); + fn F[me: Self]() -> i32 { + return G() + me.H(); } fn G() -> i32 { return 1; } - fn H[self: Self]() -> i32 { return 2; } + fn H[me: Self]() -> i32 { return 2; } } fn Main() -> i32 { diff --git a/explorer/testdata/return/convert_return_value.carbon b/explorer/testdata/return/convert_return_value.carbon index fa50a36211d19..d18fc47720bc4 100644 --- a/explorer/testdata/return/convert_return_value.carbon +++ b/explorer/testdata/return/convert_return_value.carbon @@ -13,7 +13,7 @@ package ExplorerTest api; class A { impl as ImplicitAs(i32) { - fn Convert[self: Self]() -> i32 { return 42; } + fn Convert[me: Self]() -> i32 { return 42; } } } diff --git a/explorer/testdata/while/convert_condition.carbon b/explorer/testdata/while/convert_condition.carbon index 6d15433954d14..bf3b3a07bab44 100644 --- a/explorer/testdata/while/convert_condition.carbon +++ b/explorer/testdata/while/convert_condition.carbon @@ -15,8 +15,8 @@ class LazyNe { var v1: i32; var v2: i32; impl as ImplicitAs(Bool) { - fn Convert[self: Self]() -> Bool { - return not (self.v1 == self.v2); + fn Convert[me: Self]() -> Bool { + return not (me.v1 == me.v2); } } fn Make(v1: i32, v2: i32) -> Self { diff --git a/third_party/examples/re2/re2.carbon b/third_party/examples/re2/re2.carbon index 68e243cb71a12..ba40a0491e6d2 100644 --- a/third_party/examples/re2/re2.carbon +++ b/third_party/examples/re2/re2.carbon @@ -290,52 +290,52 @@ class RE2 { // TODO: Should a Carbonic RE2 support these? impl StringView as ImplicitAs(RE2) { - fn Convert[self: Self]() -> RE2 { return Make(self); } + fn Convert[me: Self]() -> RE2 { return Make(me); } } impl String as ImplicitAs(RE2) { - fn Convert[self: Self]() -> RE2 { return Make(self); } + fn Convert[me: Self]() -> RE2 { return Make(me); } } impl StringPiece as ImplicitAs(RE2) { - fn Convert[self: Self]() -> RE2 { return Make(self); } + fn Convert[me: Self]() -> RE2 { return Make(me); } } impl as Destroyable; // Returns whether RE2 was created properly. - fn ok[self: Self]() -> Bool { return self.error_code() == ErrorCode.NoError; } + fn ok[me: Self]() -> Bool { return me.error_code() == ErrorCode.NoError; } // The string specification for this RE2. E.g. // RE2 re("ab*c?d+"); // re.pattern(); // "ab*c?d+" - fn pattern[self: Self]() -> String { return self.pattern_; } + fn pattern[me: Self]() -> String { return me.pattern_; } // If RE2 could not be created properly, returns an error string. // Else returns the empty string. - fn error[self: Self]() -> String { return *self.error_; } + fn error[me: Self]() -> String { return *me.error_; } // If RE2 could not be created properly, returns an error code. // Else returns RE2::NoError (== 0). - fn error_code[self: Self]() -> ErrorCode { return self.error_code_; } + fn error_code[me: Self]() -> ErrorCode { return me.error_code_; } // If RE2 could not be created properly, returns the offending // portion of the regexp. - fn error_arg[self: Self]() -> String { return self.error_arg_; } + fn error_arg[me: Self]() -> String { return me.error_arg_; } // Returns the program size, a very approximate measure of a regexp's "cost". // Larger numbers are more expensive than smaller numbers. - fn ProgramSize[self: Self]() -> i32; - fn ReverseProgramSize[self: Self]() -> i32; + fn ProgramSize[me: Self]() -> i32; + fn ReverseProgramSize[me: Self]() -> i32; // If histogram is not null, outputs the program fanout // as a histogram bucketed by powers of 2. // Returns the number of the largest non-empty bucket. - fn ProgramFanout[self: Self](histogram: Cpp.std.vector(i32)*) -> i32; - fn ReverseProgramFanout[self: Self](histogram: Cpp.std.vector(i32)*) -> i32; + fn ProgramFanout[me: Self](histogram: Cpp.std.vector(i32)*) -> i32; + fn ReverseProgramFanout[me: Self](histogram: Cpp.std.vector(i32)*) -> i32; // Returns the underlying Regexp; not for general use. // Returns entire_regexp_ so that callers don't need // to know about prefix_ and prefix_foldcase_. - fn Regexp[self: Self]() -> package.Regexp* { return self.entire_regexp_; } + fn Regexp[me: Self]() -> package.Regexp* { return me.entire_regexp_; } /***** The array-based matching interface ******/ @@ -535,7 +535,7 @@ class RE2 { // do not compile down to infinite repetitions. // // Returns true on success, false on error. - fn PossibleMatchRange[self: Self](min: String*, max: String*, maxlen: i32); + fn PossibleMatchRange[me: Self](min: String*, max: String*, maxlen: i32); // Generic matching interface @@ -552,18 +552,18 @@ class RE2 { // Return the number of capturing subpatterns, or -1 if the // regexp wasn't valid on construction. The overall match ($0) // does not count: if the regexp is "(a)(b)", returns 2. - fn NumberOfCapturingGroups[self: Self]() -> i32 { return self.num_captures_; } + fn NumberOfCapturingGroups[me: Self]() -> i32 { return me.num_captures_; } // Return a map from names to capturing indices. // The map records the index of the leftmost group // with the given name. // NOTE: Originally returned by reference with comment "valid until re is deleted". - fn NamedCapturingGroups[self: Self]() -> Map(String, i32); + fn NamedCapturingGroups[me: Self]() -> Map(String, i32); // Return a map from capturing indices to names. // The map has no entries for unnamed groups. // NOTE: Originally returned by reference with comment "valid until re is deleted". - fn CapturingGroupNames[self: Self]() -> Map(i32, String); + fn CapturingGroupNames[me: Self]() -> Map(i32, String); // General matching routine. // Match against text starting at offset startpos @@ -586,7 +586,7 @@ class RE2 { // empty string, but note that on return, it will not be possible to tell // whether submatch i matched the empty string or did not match: // either way, submatch[i].data() == NULL. - fn Match[self: Self](text: StringPiece, + fn Match[me: Self](text: StringPiece, startpos: i64, endpos: i64, re_anchor: Anchor, @@ -602,7 +602,7 @@ class RE2 { // '\' followed by anything other than a digit or '\'. // A true return value guarantees that Replace() and Extract() won't // fail because of a bad rewrite string. - fn CheckRewriteString[self: Self](rewrite: StringPiece, error: String*) -> bool; + fn CheckRewriteString[me: Self](rewrite: StringPiece, error: String*) -> bool; // Returns the maximum submatch needed for the rewrite to be done by // Replace(). E.g. if rewrite == "foo \\2,\\1", returns 2. @@ -613,7 +613,7 @@ class RE2 { // Returns true on success. This method can fail because of a malformed // rewrite string. CheckRewriteString guarantees that the rewrite will // be successful. - fn Rewrite[self: Self](out: String*, rewrite: StringPiece, + fn Rewrite[me: Self](out: String*, rewrite: StringPiece, vec: ArrayIterator(StringPiece), veclen: i32) -> bool; @@ -696,50 +696,50 @@ class RE2 { impl CannedOptions as ImplicitAs(Self); - fn encoding[self: Self]() -> Encoding { return self.encoding_; } - fn set_encoding[addr self: Self*](encoding: Encoding) { self->encoding_ = encoding; } + fn encoding[me: Self]() -> Encoding { return me.encoding_; } + fn set_encoding[addr me: Self*](encoding: Encoding) { me->encoding_ = encoding; } - fn posix_syntax[self: Self]() -> bool { return self.posix_syntax_; } - fn set_posix_syntax[addr self: Self*](b: bool) { self->posix_syntax_ = b; } + fn posix_syntax[me: Self]() -> bool { return me.posix_syntax_; } + fn set_posix_syntax[addr me: Self*](b: bool) { me->posix_syntax_ = b; } - fn longest_match[self: Self]() -> bool { return self.longest_match_; } - fn set_longest_match[addr self: Self*](b: bool) { self->longest_match_ = b; } + fn longest_match[me: Self]() -> bool { return me.longest_match_; } + fn set_longest_match[addr me: Self*](b: bool) { me->longest_match_ = b; } - fn log_errors[self: Self]() -> bool { return self.log_errors_; } - fn set_log_errors[addr self: Self*](b: bool) { self->log_errors_ = b; } + fn log_errors[me: Self]() -> bool { return me.log_errors_; } + fn set_log_errors[addr me: Self*](b: bool) { me->log_errors_ = b; } - fn max_mem[self: Self]() -> i64 { return self.max_mem_; } - fn set_max_mem[addr self: Self*](m: i64) { self->max_mem_ = m; } + fn max_mem[me: Self]() -> i64 { return me.max_mem_; } + fn set_max_mem[addr me: Self*](m: i64) { me->max_mem_ = m; } - fn literal[self: Self]() -> bool { return self.literal_; } - fn set_literal[addr self: Self*](b: bool) { self->literal_ = b; } + fn literal[me: Self]() -> bool { return me.literal_; } + fn set_literal[addr me: Self*](b: bool) { me->literal_ = b; } - fn never_nl[self: Self]() -> bool { return self.never_nl_; } - fn set_never_nl[addr self: Self*](b: bool) { self->never_nl_ = b; } + fn never_nl[me: Self]() -> bool { return me.never_nl_; } + fn set_never_nl[addr me: Self*](b: bool) { me->never_nl_ = b; } - fn dot_nl[self: Self]() -> bool { return self.dot_nl_; } - fn set_dot_nl[addr self: Self*](b: bool) { self->dot_nl_ = b; } + fn dot_nl[me: Self]() -> bool { return me.dot_nl_; } + fn set_dot_nl[addr me: Self*](b: bool) { me->dot_nl_ = b; } - fn never_capture[self: Self]() -> bool { return self.never_capture_; } - fn set_never_capture[addr self: Self*](b: bool) { self->never_capture_ = b; } + fn never_capture[me: Self]() -> bool { return me.never_capture_; } + fn set_never_capture[addr me: Self*](b: bool) { me->never_capture_ = b; } - fn case_sensitive[self: Self]() -> bool { return self.case_sensitive_; } - fn set_case_sensitive[addr self: Self*](b: bool) { self->case_sensitive_ = b; } + fn case_sensitive[me: Self]() -> bool { return me.case_sensitive_; } + fn set_case_sensitive[addr me: Self*](b: bool) { me->case_sensitive_ = b; } - fn perl_classes[self: Self]() -> bool { return self.perl_classes_; } - fn set_perl_classes[addr self: Self*](b: bool) { self->perl_classes_ = b; } + fn perl_classes[me: Self]() -> bool { return me.perl_classes_; } + fn set_perl_classes[addr me: Self*](b: bool) { me->perl_classes_ = b; } - fn word_boundary[self: Self]() -> bool { return self.word_boundary_; } - fn set_word_boundary[addr self: Self*](b: bool) { self->word_boundary_ = b; } + fn word_boundary[me: Self]() -> bool { return me.word_boundary_; } + fn set_word_boundary[addr me: Self*](b: bool) { me->word_boundary_ = b; } - fn one_line[self: Self]() -> bool { return self.one_line_; } - fn set_one_line[addr self: Self*](b: bool) { self->one_line_ = b; } + fn one_line[me: Self]() -> bool { return me.one_line_; } + fn set_one_line[addr me: Self*](b: bool) { me->one_line_ = b; } - fn Copy[addr self: Self*](src: Options) { - *self = src; + fn Copy[addr me: Self*](src: Options) { + *me = src; } - fn ParseFlags[self: Self]() -> i32; + fn ParseFlags[me: Self]() -> i32; private var encoding_: Encoding; private var posix_syntax_: bool; @@ -757,7 +757,7 @@ class RE2 { }; // Returns the options set in the constructor. - fn options[self: Self]() -> Options { return self.options_; } + fn options[me: Self]() -> Options { return me.options_; } // Argument converters; see below. // TODO: Should these be package members not class members in Carbon @@ -766,9 +766,9 @@ class RE2 { fn Hex[T:! Parse4ary](ptr: T*) -> Self.Arg; fn Octal[T:! Parse4ary](ptr: T*) -> Self.Arg; - private fn Init[addr self: Self](pattern: StringPiece, options: Options); + private fn Init[addr me: Self](pattern: StringPiece, options: Options); - private fn DoMatch[self: Self](text: StringPiece, + private fn DoMatch[me: Self](text: StringPiece, re_anchor: Anchor, consumed: i64*, // TODO: Pointer to `const Arg`. @@ -776,7 +776,7 @@ class RE2 { n: i32) -> bool; - fn ReverseProg[self: Self]() -> package.Prog*; + fn ReverseProg[me: Self]() -> package.Prog*; // string regular expression private var pattern_: String; @@ -853,30 +853,30 @@ class RE2.Arg { fn Make(nullptr) -> Self { return Make(nullptr as NullArg*); } interface Parseable { - fn Parse[addr self: Self*](str: StringView, n: i64) -> bool; + fn Parse[addr me: Self*](str: StringView, n: i64) -> bool; } match_first { impl [T:! Parse3ary] T as Parseable { - fn Parse[addr self: Self*](str: StringView, n: i64) -> bool { - return T.Parse(str, n, self); + fn Parse[addr me: Self*](str: StringView, n: i64) -> bool { + return T.Parse(str, n, me); } } impl [T:! Parse4ary] T as Parseable { - fn Parse[addr self: Self*](str: StringView, n: i64) -> bool { - return T.Parse(str, n, self, 10); + fn Parse[addr me: Self*](str: StringView, n: i64) -> bool { + return T.Parse(str, n, me, 10); } } impl [T:! ParseFrom] T as Parseable { - fn Parse[addr self: Self*](str: StringView, n: i64) -> bool { - if (self == nullptr) { return true; } - return T.Parse(str, n, self); + fn Parse[addr me: Self*](str: StringView, n: i64) -> bool { + if (me == nullptr) { return true; } + return T.Parse(str, n, me); } } } private class NullArg {} impl NullArg as Parseable { - fn Parse[addr self: Self*](str: StringView, n: i64) -> bool { + fn Parse[addr me: Self*](str: StringView, n: i64) -> bool { return true; } } @@ -885,8 +885,8 @@ class RE2.Arg { return {.type_ = T, .arg_ = ptr}; } - fn Parse[self: Self](str: StringView, n: i64) -> bool { - return self.arg_->Parse(str, n); + fn Parse[me: Self](str: StringView, n: i64) -> bool { + return me.arg_->Parse(str, n); } // TODO: Existential types or `DynPtr(Parseable)`. @@ -896,8 +896,8 @@ class RE2.Arg { private adapter ParseAsBase(T:! Parse4ary, base: i32) for T { impl as Self.Arg.Parseable { - fn Parse[addr self: Self*](str: StringView, n: i64) -> bool { - return T.Parse(str, n, self, base); + fn Parse[addr me: Self*](str: StringView, n: i64) -> bool { + return T.Parse(str, n, me, base); } } } @@ -938,12 +938,12 @@ class LazyRE2 { // Pretend to be a pointer to Type (never NULL due to on-demand creation): impl as Pointer where .Pointee = RE2 { - fn Resolve[self: Self]() -> Pointee* { return self.get(); } + fn Resolve[me: Self]() -> Pointee* { return me.get(); } } // Named accessor/initializer: - fn get[addr self: Self*]() -> RE* { - Cpp.std.call_once(once_, Self.Init, self); + fn get[addr me: Self*]() -> RE* { + Cpp.std.call_once(once_, Self.Init, me); return ptr_; } diff --git a/utils/highlightjs/highlightjs_carbon_lang.js b/utils/highlightjs/highlightjs_carbon_lang.js index 8c7d54965616a..a17ab6d6450b9 100644 --- a/utils/highlightjs/highlightjs_carbon_lang.js +++ b/utils/highlightjs/highlightjs_carbon_lang.js @@ -56,7 +56,7 @@ export default function (hljs) { 'library', 'like', 'match', - 'self', + 'me', 'namespace', 'not', 'observe', @@ -269,8 +269,8 @@ export default function (hljs) { returnEnd: true, contains: [...EXPRESSION], }; - const SELF_PATTERN = { - scope: 'carbon-self-pattern', + const ME_PATTERN = { + scope: 'carbon-me-pattern', begin: [/(\b(addr|var)\b)?/, /\s*/, /\bme/, /:/, /\s*/], beginScope: { 1: 'keyword', @@ -281,11 +281,7 @@ export default function (hljs) { returnEnd: true, contains: [...EXPRESSION], }; - const UNPARENTHESIZED_PATTERNS = [ - SELF_PATTERN, - BINDING_PATTERN, - VALUE_PATTERN, - ]; + const UNPARENTHESIZED_PATTERNS = [ME_PATTERN, BINDING_PATTERN, VALUE_PATTERN]; const PARENTHESIZED_PATTERN = { scope: 'carbon-parenthesized-pattern', begin: /\(/, diff --git a/utils/highlightjs/highlightjs_example.html b/utils/highlightjs/highlightjs_example.html index 3df0e87f40e15..0a431e437567c 100644 --- a/utils/highlightjs/highlightjs_example.html +++ b/utils/highlightjs/highlightjs_example.html @@ -50,14 +50,14 @@ } abstract class Abstract { - abstract fn DoSomething[self: Self](); + abstract fn DoSomething[me: Self](); } base class Widget { - virtual fn Print[addr self: Self*](var i: i64, x: f32 = 4.2, _: bool); + virtual fn Print[addr me: Self*](var i: i64, x: f32 = 4.2, _: bool); } -fn Widget.Print[addr self: Self*](var i: i64, x: f32, _: bool, 47) { +fn Widget.Print[addr me: Self*](var i: i64, x: f32, _: bool, 47) { Carbon.Print("test" + "t\u{FFFF}his"); Carbon.Print( """ @@ -72,14 +72,14 @@ } class FancyWidget(T:! Type) extends Widget { - impl fn Print[self: Self](); + impl fn Print[me: Self](); impl as Add(T) { - fn Op[self: Self](); + fn Op[me: Self](); } } -fn FancyWidget(T:! Type).Print[self: Self]() { +fn FancyWidget(T:! Type).Print[me: Self]() { Carbon.Print("more test"); } From b3a839b74340cf738269d6b678c53d36a8dac511 Mon Sep 17 00:00:00 2001 From: Josh L Date: Sat, 23 Jul 2022 21:37:48 +0000 Subject: [PATCH 16/20] Restore fuzzer_corpus --- .../06a307aa1f2980c9c38aec7f31dc5c6c2cdb29f9 | 218 ++++ .../06f83aef3f9e01311a3278cd23a2abc77c49915f | 283 +++++ .../099a7eccb906876e50a4d9e1725e3a9adcc8a742 | 247 ++++ .../0cad2b9a3a6fc8cc8cd69df93c665c44a4cf09da | 383 ++++++ .../127b893cd279bdcff0f2d37493b3e975aa86c4e3 | 645 ++++++++++ .../14094da539080d20eebd0cca6fac5ad4fa57069e | 174 +++ .../14f8edf9c4ee423d1613fbbf76c6f9b4ce62be0c | 1098 ++++++++++++++++ .../18b53ef8c05b1929dd8e1790c84ea9c463a43434 | 244 ++++ .../192dc5815905d8b0540486bfc0638c978d20039c | 623 +++++++++ .../1c52c6482c396a582135715d8e633cca4febe2b6 | 1124 +++++++++++++++++ .../259e262f9509cb8a3e564d29d397ae42670b3c9c | 309 +++++ .../2bbbfc37b0f9199a50d33d34c488d0a197872033 | 294 +++++ .../2db6570b8cfc6e5021152d0424c6c068a868355d | 766 +++++++++++ .../2f4d8beb260713992ac947221dff3dc7cdd75096 | 345 +++++ .../308d94ff5bf03c10d183bace81bc2f3641a68311 | 245 ++++ .../350c28992cc3659ed0d99c0cd88376346e9958cc | 1104 ++++++++++++++++ .../35a3028fcdb70945c6c7db9e7154b08543f0dc17 | 82 ++ .../3ec79d5d498edae7c9cc422fd5087a7dedf6394c | 567 +++++++++ .../409a3e4b8dcbe38b5a8ca74e701205708d8c05a4 | 571 +++++++++ .../43a5f1124cf3bf76c63cd184ba30cb654a790ff7 | 505 ++++++++ .../44032fb64eaa572d1e2ae4d500db23ae32355380 | 669 ++++++++++ .../457c811489db1e3f987633ce1fb2dce7d984fb66 | 305 +++++ .../4ce3a6280cb42032b421b2ada1018f692720e17d | 402 ++++++ .../4ee491109d08f78764e3ed9a59f36521e348650b | 120 ++ .../51a6ff8051dffb6bc7c57b437a526d8f1ed37a57 | 223 ++++ .../536c060cc8df53b0132be40dbbc67f1df1775bac | 325 +++++ .../538556cd683ca838d1ffefb154cda7a804b3eafe | 270 ++++ .../55ccba2998142de2e42b6f1daf02d8753579f38e | 411 ++++++ .../5def149b950eae9d5fae3e3fadbdfc1e0d322cbc | 161 +++ .../5fc78caa03024255c5c7015e6e3c0bc97f5a4c1e | 805 ++++++++++++ .../60469f199bd3244e105b0446c25cc23b6a768eae | 805 ++++++++++++ .../62c7aa55a12ef5ad4a7cec26ea7c3f0ed82ae24a | 694 ++++++++++ .../63979179f0b4279dbf7a98a3a7b9837393d43e8a | 257 ++++ .../659e20bff50e0abe4f7d58e8e0b739ad2a5048b9 | 403 ++++++ .../65c24d040bbc26b5e1fea735ddf1755392471a18 | 614 +++++++++ .../71035d013bdc57394db132778f7934164475cff1 | 233 ++++ .../74bd01b6ca01991c40cb7e2129d34602c5807542 | 418 ++++++ .../75c68060eb8633b81c8c183d8e52b386a6f40b6e | 857 +++++++++++++ .../76e8a4678c5aa0cfcce078571739a299702810b7 | 588 +++++++++ .../91e906e0d538a96c1414d805872f0a3159529471 | 293 +++++ .../975fcd972f9644c64177a30109d358cde488ec9c | 324 +++++ .../988b50fcd2641207a813cbb1fd6d8e5b3c82b07b | 686 ++++++++++ .../9a73b722edc48fc49e85c9221d5cdd6423f8f38a | 283 +++++ .../9ada7039985bcf2aeea353a2e74e93cfdc8b432e | 126 ++ .../a88508d94032d0429d1cba11c1df90deb142c155 | 200 +++ .../ab1a6d3ba7f35f95cd5aafdbf1f4b031de1a0f6b | 669 ++++++++++ .../ad532018fa2a099d303e2439b0c39557aecf8e00 | 110 ++ .../ad6c39ea6ec9ed5867500173d2aaa1200bbc06a6 | 174 +++ .../b2bb0268ca91b380d18d8b4e26f8188830ad584b | 164 +++ .../b3be1b28b64d4a3b2da9d7a2da48e4094e7102bf | 180 +++ .../b671a41b29603d99d57b69e15c8ee86017b58555 | 228 ++++ .../b717b68f111caf8b50c27f029988cd55d8d6eb83 | 768 +++++++++++ .../b77f0f9be78ea2cf33d09e3ac7991e7560b8279f | 151 +++ .../b77f65badb388ae3942c31237a85c8826c4e5648 | 283 +++++ .../b9a64e39653c7cced9aad24e6e5d325ef5830379 | 645 ++++++++++ .../ba1f80b94d3fbfede410d99944c2f916f18a66d9 | 855 +++++++++++++ .../c258828edd9181d61e184e6e73c9b34729ea69cc | 324 +++++ .../cc4eceeba65c5547929371ff26806e82c5a776f3 | 712 +++++++++++ .../cd34239ea7c7fb125a300068dce22b77d9e1effa | 495 ++++++++ .../d4060117085d164112756d399d7e3822e83f6c7a | 700 ++++++++++ .../d415017d19f5638734278f41adaa345e510f90d2 | 124 ++ .../d66f6dd50287a3f1d0d2ab22a9b7a6aee9d3a435 | 266 ++++ .../d829468ac733b7dd5677070c722c3c7ecd34c496 | 183 +++ .../dd3ba18239f1a0b8d128fb996df5957c04676354 | 565 +++++++++ .../de61c912b8d3923ee9b6f46603394c1171c06f40 | 300 +++++ .../df26c1e8e0e4003833b754f9265c211e25e3e9d6 | 976 ++++++++++++++ .../e5ba54dcd7ba2c5ce8ccc16ae9745c148644d837 | 374 ++++++ .../e629764c8d1fa144b53709998d97097c64b8777e | 465 +++++++ .../ec71d604f3ad77986eef7d9e78385bb475528dff | 679 ++++++++++ .../f6c7f3c7192ebe59a4329e3a991597d864cb43d9 | 645 ++++++++++ .../fc5f5e4f348579cedbecae8dccafc9f9dae68237 | 283 +++++ .../fde210ff5a67c2b595b17353fb8ef9ff9275c4db | 645 ++++++++++ 72 files changed, 32262 insertions(+) create mode 100644 explorer/fuzzing/fuzzer_corpus/06a307aa1f2980c9c38aec7f31dc5c6c2cdb29f9 create mode 100644 explorer/fuzzing/fuzzer_corpus/06f83aef3f9e01311a3278cd23a2abc77c49915f create mode 100644 explorer/fuzzing/fuzzer_corpus/099a7eccb906876e50a4d9e1725e3a9adcc8a742 create mode 100644 explorer/fuzzing/fuzzer_corpus/0cad2b9a3a6fc8cc8cd69df93c665c44a4cf09da create mode 100644 explorer/fuzzing/fuzzer_corpus/127b893cd279bdcff0f2d37493b3e975aa86c4e3 create mode 100644 explorer/fuzzing/fuzzer_corpus/14094da539080d20eebd0cca6fac5ad4fa57069e create mode 100644 explorer/fuzzing/fuzzer_corpus/14f8edf9c4ee423d1613fbbf76c6f9b4ce62be0c create mode 100644 explorer/fuzzing/fuzzer_corpus/18b53ef8c05b1929dd8e1790c84ea9c463a43434 create mode 100644 explorer/fuzzing/fuzzer_corpus/192dc5815905d8b0540486bfc0638c978d20039c create mode 100644 explorer/fuzzing/fuzzer_corpus/1c52c6482c396a582135715d8e633cca4febe2b6 create mode 100644 explorer/fuzzing/fuzzer_corpus/259e262f9509cb8a3e564d29d397ae42670b3c9c create mode 100644 explorer/fuzzing/fuzzer_corpus/2bbbfc37b0f9199a50d33d34c488d0a197872033 create mode 100644 explorer/fuzzing/fuzzer_corpus/2db6570b8cfc6e5021152d0424c6c068a868355d create mode 100644 explorer/fuzzing/fuzzer_corpus/2f4d8beb260713992ac947221dff3dc7cdd75096 create mode 100644 explorer/fuzzing/fuzzer_corpus/308d94ff5bf03c10d183bace81bc2f3641a68311 create mode 100644 explorer/fuzzing/fuzzer_corpus/350c28992cc3659ed0d99c0cd88376346e9958cc create mode 100644 explorer/fuzzing/fuzzer_corpus/35a3028fcdb70945c6c7db9e7154b08543f0dc17 create mode 100644 explorer/fuzzing/fuzzer_corpus/3ec79d5d498edae7c9cc422fd5087a7dedf6394c create mode 100644 explorer/fuzzing/fuzzer_corpus/409a3e4b8dcbe38b5a8ca74e701205708d8c05a4 create mode 100644 explorer/fuzzing/fuzzer_corpus/43a5f1124cf3bf76c63cd184ba30cb654a790ff7 create mode 100644 explorer/fuzzing/fuzzer_corpus/44032fb64eaa572d1e2ae4d500db23ae32355380 create mode 100644 explorer/fuzzing/fuzzer_corpus/457c811489db1e3f987633ce1fb2dce7d984fb66 create mode 100644 explorer/fuzzing/fuzzer_corpus/4ce3a6280cb42032b421b2ada1018f692720e17d create mode 100644 explorer/fuzzing/fuzzer_corpus/4ee491109d08f78764e3ed9a59f36521e348650b create mode 100644 explorer/fuzzing/fuzzer_corpus/51a6ff8051dffb6bc7c57b437a526d8f1ed37a57 create mode 100644 explorer/fuzzing/fuzzer_corpus/536c060cc8df53b0132be40dbbc67f1df1775bac create mode 100644 explorer/fuzzing/fuzzer_corpus/538556cd683ca838d1ffefb154cda7a804b3eafe create mode 100644 explorer/fuzzing/fuzzer_corpus/55ccba2998142de2e42b6f1daf02d8753579f38e create mode 100644 explorer/fuzzing/fuzzer_corpus/5def149b950eae9d5fae3e3fadbdfc1e0d322cbc create mode 100644 explorer/fuzzing/fuzzer_corpus/5fc78caa03024255c5c7015e6e3c0bc97f5a4c1e create mode 100644 explorer/fuzzing/fuzzer_corpus/60469f199bd3244e105b0446c25cc23b6a768eae create mode 100644 explorer/fuzzing/fuzzer_corpus/62c7aa55a12ef5ad4a7cec26ea7c3f0ed82ae24a create mode 100644 explorer/fuzzing/fuzzer_corpus/63979179f0b4279dbf7a98a3a7b9837393d43e8a create mode 100644 explorer/fuzzing/fuzzer_corpus/659e20bff50e0abe4f7d58e8e0b739ad2a5048b9 create mode 100644 explorer/fuzzing/fuzzer_corpus/65c24d040bbc26b5e1fea735ddf1755392471a18 create mode 100644 explorer/fuzzing/fuzzer_corpus/71035d013bdc57394db132778f7934164475cff1 create mode 100644 explorer/fuzzing/fuzzer_corpus/74bd01b6ca01991c40cb7e2129d34602c5807542 create mode 100644 explorer/fuzzing/fuzzer_corpus/75c68060eb8633b81c8c183d8e52b386a6f40b6e create mode 100644 explorer/fuzzing/fuzzer_corpus/76e8a4678c5aa0cfcce078571739a299702810b7 create mode 100644 explorer/fuzzing/fuzzer_corpus/91e906e0d538a96c1414d805872f0a3159529471 create mode 100644 explorer/fuzzing/fuzzer_corpus/975fcd972f9644c64177a30109d358cde488ec9c create mode 100644 explorer/fuzzing/fuzzer_corpus/988b50fcd2641207a813cbb1fd6d8e5b3c82b07b create mode 100644 explorer/fuzzing/fuzzer_corpus/9a73b722edc48fc49e85c9221d5cdd6423f8f38a create mode 100644 explorer/fuzzing/fuzzer_corpus/9ada7039985bcf2aeea353a2e74e93cfdc8b432e create mode 100644 explorer/fuzzing/fuzzer_corpus/a88508d94032d0429d1cba11c1df90deb142c155 create mode 100644 explorer/fuzzing/fuzzer_corpus/ab1a6d3ba7f35f95cd5aafdbf1f4b031de1a0f6b create mode 100644 explorer/fuzzing/fuzzer_corpus/ad532018fa2a099d303e2439b0c39557aecf8e00 create mode 100644 explorer/fuzzing/fuzzer_corpus/ad6c39ea6ec9ed5867500173d2aaa1200bbc06a6 create mode 100644 explorer/fuzzing/fuzzer_corpus/b2bb0268ca91b380d18d8b4e26f8188830ad584b create mode 100644 explorer/fuzzing/fuzzer_corpus/b3be1b28b64d4a3b2da9d7a2da48e4094e7102bf create mode 100644 explorer/fuzzing/fuzzer_corpus/b671a41b29603d99d57b69e15c8ee86017b58555 create mode 100644 explorer/fuzzing/fuzzer_corpus/b717b68f111caf8b50c27f029988cd55d8d6eb83 create mode 100644 explorer/fuzzing/fuzzer_corpus/b77f0f9be78ea2cf33d09e3ac7991e7560b8279f create mode 100644 explorer/fuzzing/fuzzer_corpus/b77f65badb388ae3942c31237a85c8826c4e5648 create mode 100644 explorer/fuzzing/fuzzer_corpus/b9a64e39653c7cced9aad24e6e5d325ef5830379 create mode 100644 explorer/fuzzing/fuzzer_corpus/ba1f80b94d3fbfede410d99944c2f916f18a66d9 create mode 100644 explorer/fuzzing/fuzzer_corpus/c258828edd9181d61e184e6e73c9b34729ea69cc create mode 100644 explorer/fuzzing/fuzzer_corpus/cc4eceeba65c5547929371ff26806e82c5a776f3 create mode 100644 explorer/fuzzing/fuzzer_corpus/cd34239ea7c7fb125a300068dce22b77d9e1effa create mode 100644 explorer/fuzzing/fuzzer_corpus/d4060117085d164112756d399d7e3822e83f6c7a create mode 100644 explorer/fuzzing/fuzzer_corpus/d415017d19f5638734278f41adaa345e510f90d2 create mode 100644 explorer/fuzzing/fuzzer_corpus/d66f6dd50287a3f1d0d2ab22a9b7a6aee9d3a435 create mode 100644 explorer/fuzzing/fuzzer_corpus/d829468ac733b7dd5677070c722c3c7ecd34c496 create mode 100644 explorer/fuzzing/fuzzer_corpus/dd3ba18239f1a0b8d128fb996df5957c04676354 create mode 100644 explorer/fuzzing/fuzzer_corpus/de61c912b8d3923ee9b6f46603394c1171c06f40 create mode 100644 explorer/fuzzing/fuzzer_corpus/df26c1e8e0e4003833b754f9265c211e25e3e9d6 create mode 100644 explorer/fuzzing/fuzzer_corpus/e5ba54dcd7ba2c5ce8ccc16ae9745c148644d837 create mode 100644 explorer/fuzzing/fuzzer_corpus/e629764c8d1fa144b53709998d97097c64b8777e create mode 100644 explorer/fuzzing/fuzzer_corpus/ec71d604f3ad77986eef7d9e78385bb475528dff create mode 100644 explorer/fuzzing/fuzzer_corpus/f6c7f3c7192ebe59a4329e3a991597d864cb43d9 create mode 100644 explorer/fuzzing/fuzzer_corpus/fc5f5e4f348579cedbecae8dccafc9f9dae68237 create mode 100644 explorer/fuzzing/fuzzer_corpus/fde210ff5a67c2b595b17353fb8ef9ff9275c4db diff --git a/explorer/fuzzing/fuzzer_corpus/06a307aa1f2980c9c38aec7f31dc5c6c2cdb29f9 b/explorer/fuzzing/fuzzer_corpus/06a307aa1f2980c9c38aec7f31dc5c6c2cdb29f9 new file mode 100644 index 0000000000000..527e92be266f3 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/06a307aa1f2980c9c38aec7f31dc5c6c2cdb29f9 @@ -0,0 +1,218 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "Point" + members { + function { + name: "Get" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_statement { + expression { + identifier { + name: "V" + } + } + } + } + } + } + } + type_params { + fields { + generic_binding { + name: "T" + type { + type_type_literal { + } + } + } + } + fields { + generic_binding { + name: "V" + type { + identifier { + name: "T" + } + } + } + } + } + } + } + declarations { + function { + name: "F" + param_pattern { + fields { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + fields { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "Get" + object { + identifier { + name: "p" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + fields { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + init { + struct_type_literal { + } + } + } + } + statements { + return_statement { + expression { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "v" + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/06f83aef3f9e01311a3278cd23a2abc77c49915f b/explorer/fuzzing/fuzzer_corpus/06f83aef3f9e01311a3278cd23a2abc77c49915f new file mode 100644 index 0000000000000..a4f580a273f0e --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/06f83aef3f9e01311a3278cd23a2abc77c49915f @@ -0,0 +1,283 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "Point" + members { + function { + name: "Origin" + param_pattern { + fields { + binding_pattern { + name: "zero" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + identifier { + name: "zero" + } + } + } + fields { + name: "y" + expression { + identifier { + name: "zero" + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "GetX" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_statement { + expression { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + type_params { + fields { + generic_binding { + name: "T" + type { + int_type_literal { + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Origin" + object { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "GetX" + object { + identifier { + name: "p" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/099a7eccb906876e50a4d9e1725e3a9adcc8a742 b/explorer/fuzzing/fuzzer_corpus/099a7eccb906876e50a4d9e1725e3a9adcc8a742 new file mode 100644 index 0000000000000..f95456741248e --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/099a7eccb906876e50a4d9e1725e3a9adcc8a742 @@ -0,0 +1,247 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "A" + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "A" + } + } + interface { + call { + function { + identifier { + name: "ImplicitAs" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + members { + function { + name: "Convert" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_type_literal { + } + } + } + } + statements { + match { + expression { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + identifier { + name: "a" + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + expression_pattern { + expression { + int_literal { + value: 0 + } + } + } + } + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + } + } + statement { + return_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + fields { + expression_pattern { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + statement { + return_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + clauses { + pattern { + expression_pattern { + expression { + tuple_literal { + fields { + int_literal { + value: 1 + } + } + fields { + int_literal { + value: 1 + } + } + } + } + } + } + statement { + return_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + statements { + return_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/0cad2b9a3a6fc8cc8cd69df93c665c44a4cf09da b/explorer/fuzzing/fuzzer_corpus/0cad2b9a3a6fc8cc8cd69df93c665c44a4cf09da new file mode 100644 index 0000000000000..c5f03dc1eceaa --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/0cad2b9a3a6fc8cc8cd69df93c665c44a4cf09da @@ -0,0 +1,383 @@ +compilation_unit { + package_statement { + package_name: "Foo" + } + is_api: true + declarations { + interface { + name: "A" + members { + function { + name: "F" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "o" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "X" + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + identifier { + name: "A" + } + } + members { + function { + name: "F" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "o" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "n" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "n" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "n" + object { + identifier { + name: "o" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "F" + deduced_parameters { + name: "T" + type { + identifier { + name: "A" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "w" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + compound_member_access { + object { + identifier { + name: "v" + } + } + path { + compound_member_access { + object { + identifier { + name: "T" + } + } + path { + simple_member_access { + field: "F" + object { + identifier { + name: "A" + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "w" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + identifier { + name: "X" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "w" + type { + expression_pattern { + expression { + identifier { + name: "X" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + statements { + return_statement { + expression { + simple_member_access { + field: "n" + object { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "v" + } + } + fields { + identifier { + name: "w" + } + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/127b893cd279bdcff0f2d37493b3e975aa86c4e3 b/explorer/fuzzing/fuzzer_corpus/127b893cd279bdcff0f2d37493b3e975aa86c4e3 new file mode 100644 index 0000000000000..744f70b181265 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/127b893cd279bdcff0f2d37493b3e975aa86c4e3 @@ -0,0 +1,645 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Vector" + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + identifier { + name: "Vector" + } + } + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 0 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "AddAndScaleGeneric" + deduced_parameters { + name: "T" + type { + identifier { + name: "Vector" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "s" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "Scale" + object { + call { + function { + simple_member_access { + field: "Add" + object { + identifier { + name: "a" + } + } + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "T" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "s" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 2 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + identifier { + name: "AddAndScaleGeneric" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + int_literal { + value: 5 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "p" + } + } + } + } + arguments { + int_literal { + value: 10 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/14094da539080d20eebd0cca6fac5ad4fa57069e b/explorer/fuzzing/fuzzer_corpus/14094da539080d20eebd0cca6fac5ad4fa57069e new file mode 100644 index 0000000000000..c8480e948886a --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/14094da539080d20eebd0cca6fac5ad4fa57069e @@ -0,0 +1,174 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + choice { + name: "A" + alternatives { + name: "Value" + signature { + fields { + int_type_literal { + } + } + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + int_type_literal { + } + } + interface { + call { + function { + identifier { + name: "ImplicitAs" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "A" + } + } + } + } + } + } + members { + function { + name: "Convert" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "A" + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "Value" + object { + identifier { + name: "A" + } + } + } + } + argument { + tuple_literal { + fields { + operator { + op: Add + arguments { + identifier { + name: "me" + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + alternative_pattern { + choice_type { + identifier { + name: "A" + } + } + alternative_name: "Value" + arguments { + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + init { + int_literal { + value: 2 + } + } + } + } + statements { + return_statement { + expression { + identifier { + name: "n" + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/14f8edf9c4ee423d1613fbbf76c6f9b4ce62be0c b/explorer/fuzzing/fuzzer_corpus/14f8edf9c4ee423d1613fbbf76c6f9b4ce62be0c new file mode 100644 index 0000000000000..252b16dca99e2 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/14f8edf9c4ee423d1613fbbf76c6f9b4ce62be0c @@ -0,0 +1,1098 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "AddMul" + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "o" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Mul" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "o" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + int_type_literal { + } + } + interface { + identifier { + name: "AddMul" + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "o" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + operator { + op: Add + arguments { + identifier { + name: "me" + } + } + arguments { + identifier { + name: "o" + } + } + } + } + } + } + } + } + } + members { + function { + name: "Mul" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "o" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + operator { + op: Mul + arguments { + identifier { + name: "me" + } + } + arguments { + identifier { + name: "o" + } + } + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name: "Holder" + members { + variable { + binding { + name: "v" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + type_params { + fields { + generic_binding { + name: "T" + type { + identifier { + name: "AddMul" + } + } + } + } + } + } + } + declarations { + interface { + name: "Vector" + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + identifier { + name: "Scalar" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Hold" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + identifier { + name: "Scalar" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "Holder" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "Scalar" + } + } + } + } + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Point" + } + } + interface { + call { + function { + identifier { + name: "Vector" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 0 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Hold" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "Holder" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "v" + expression { + identifier { + name: "v" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "AddAndScaleGeneric" + deduced_parameters { + name: "T" + type { + identifier { + name: "AddMul" + } + } + } + deduced_parameters { + name: "U" + type { + call { + function { + identifier { + name: "Vector" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "U" + } + } + } + } + } + } + fields { + binding_pattern { + name: "s" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "U" + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "Scale" + object { + call { + function { + simple_member_access { + field: "Add" + object { + identifier { + name: "a" + } + } + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "U" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + simple_member_access { + field: "v" + object { + call { + function { + simple_member_access { + field: "Hold" + object { + identifier { + name: "a" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "s" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 2 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + identifier { + name: "AddAndScaleGeneric" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + int_literal { + value: 5 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "p" + } + } + } + } + arguments { + int_literal { + value: 10 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/18b53ef8c05b1929dd8e1790c84ea9c463a43434 b/explorer/fuzzing/fuzzer_corpus/18b53ef8c05b1929dd8e1790c84ea9c463a43434 new file mode 100644 index 0000000000000..cada50db1336f --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/18b53ef8c05b1929dd8e1790c84ea9c463a43434 @@ -0,0 +1,244 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "A" + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + call { + function { + identifier { + name: "ImplicitAs" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + members { + function { + name: "Convert" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + simple_member_access { + field: "n" + object { + identifier { + name: "me" + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + fields { + var_pattern { + pattern { + binding_pattern { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + identifier { + name: "b" + } + } + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Add + arguments { + identifier { + name: "x" + } + } + arguments { + identifier { + name: "y" + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/192dc5815905d8b0540486bfc0638c978d20039c b/explorer/fuzzing/fuzzer_corpus/192dc5815905d8b0540486bfc0638c978d20039c new file mode 100644 index 0000000000000..b55bc1b42a3fc --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/192dc5815905d8b0540486bfc0638c978d20039c @@ -0,0 +1,623 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Vector" + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Point" + } + } + interface { + identifier { + name: "Vector" + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "AddAndScaleGeneric" + deduced_parameters { + name: "T" + type { + identifier { + name: "Vector" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "s" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "m" + type { + auto_pattern { + } + } + } + } + init { + simple_member_access { + field: "Add" + object { + identifier { + name: "a" + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "n" + type { + auto_pattern { + } + } + } + } + init { + simple_member_access { + field: "Scale" + object { + call { + function { + identifier { + name: "m" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + call { + function { + identifier { + name: "n" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "s" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 0 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 2 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 3 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + identifier { + name: "AddAndScaleGeneric" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + identifier { + name: "b" + } + } + fields { + int_literal { + value: 3 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "p" + } + } + } + } + arguments { + int_literal { + value: 6 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/1c52c6482c396a582135715d8e633cca4febe2b6 b/explorer/fuzzing/fuzzer_corpus/1c52c6482c396a582135715d8e633cca4febe2b6 new file mode 100644 index 0000000000000..beb63987c9f9f --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/1c52c6482c396a582135715d8e633cca4febe2b6 @@ -0,0 +1,1124 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "I" + members { + function { + name: "F" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + } + } + members { + function { + name: "M" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "A" + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + identifier { + name: "I" + } + } + members { + function { + name: "F" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + members { + function { + name: "M" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + } + members { + function { + name: "G" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + int_literal { + value: 3 + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + int_type_literal { + } + } + interface { + identifier { + name: "I" + } + } + members { + function { + name: "F" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + int_literal { + value: 4 + } + } + } + } + } + } + } + members { + function { + name: "M" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + int_literal { + value: 5 + } + } + } + } + } + } + } + } + } + declarations { + alias { + name: "IF" + target { + simple_member_access { + field: "F" + object { + identifier { + name: "I" + } + } + } + } + } + } + declarations { + alias { + name: "IM" + target { + simple_member_access { + field: "M" + object { + identifier { + name: "I" + } + } + } + } + } + } + declarations { + alias { + name: "AIF" + target { + compound_member_access { + object { + identifier { + name: "A" + } + } + path { + identifier { + name: "IF" + } + } + } + } + } + } + declarations { + alias { + name: "AIM" + target { + compound_member_access { + object { + identifier { + name: "A" + } + } + path { + identifier { + name: "IM" + } + } + } + } + } + } + declarations { + alias { + name: "AG" + target { + simple_member_access { + field: "G" + object { + identifier { + name: "A" + } + } + } + } + } + } + declarations { + alias { + name: "i32IF" + target { + compound_member_access { + object { + int_type_literal { + } + } + path { + identifier { + name: "IF" + } + } + } + } + } + } + declarations { + alias { + name: "i32IM" + target { + compound_member_access { + object { + int_type_literal { + } + } + path { + identifier { + name: "IM" + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + statements { + if_statement { + condition { + operator { + op: Not + arguments { + operator { + op: Eq + arguments { + call { + function { + compound_member_access { + object { + identifier { + name: "A" + } + } + path { + identifier { + name: "IF" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + } + } + then_block { + statements { + return_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + statements { + if_statement { + condition { + operator { + op: Not + arguments { + operator { + op: Eq + arguments { + call { + function { + compound_member_access { + object { + identifier { + name: "a" + } + } + path { + identifier { + name: "IF" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + } + } + then_block { + statements { + return_statement { + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + statements { + if_statement { + condition { + operator { + op: Not + arguments { + operator { + op: Eq + arguments { + call { + function { + compound_member_access { + object { + identifier { + name: "a" + } + } + path { + identifier { + name: "IM" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + arguments { + int_literal { + value: 2 + } + } + } + } + } + } + then_block { + statements { + return_statement { + expression { + int_literal { + value: 3 + } + } + } + } + } + } + } + statements { + if_statement { + condition { + operator { + op: Not + arguments { + operator { + op: Eq + arguments { + call { + function { + compound_member_access { + object { + identifier { + name: "a" + } + } + path { + compound_member_access { + object { + identifier { + name: "A" + } + } + path { + identifier { + name: "IM" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + arguments { + int_literal { + value: 2 + } + } + } + } + } + } + then_block { + statements { + return_statement { + expression { + int_literal { + value: 4 + } + } + } + } + } + } + } + statements { + if_statement { + condition { + operator { + op: Not + arguments { + operator { + op: Eq + arguments { + call { + function { + identifier { + name: "AIF" + } + } + argument { + tuple_literal { + } + } + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + } + } + then_block { + statements { + return_statement { + expression { + int_literal { + value: 5 + } + } + } + } + } + } + } + statements { + if_statement { + condition { + operator { + op: Not + arguments { + operator { + op: Eq + arguments { + call { + function { + compound_member_access { + object { + identifier { + name: "a" + } + } + path { + identifier { + name: "AIM" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + arguments { + int_literal { + value: 2 + } + } + } + } + } + } + then_block { + statements { + return_statement { + expression { + int_literal { + value: 6 + } + } + } + } + } + } + } + statements { + if_statement { + condition { + operator { + op: Not + arguments { + operator { + op: Eq + arguments { + call { + function { + compound_member_access { + object { + identifier { + name: "a" + } + } + path { + identifier { + name: "AG" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + arguments { + int_literal { + value: 3 + } + } + } + } + } + } + then_block { + statements { + return_statement { + expression { + int_literal { + value: 7 + } + } + } + } + } + } + } + statements { + if_statement { + condition { + operator { + op: Not + arguments { + operator { + op: Eq + arguments { + call { + function { + compound_member_access { + object { + int_type_literal { + } + } + path { + identifier { + name: "IF" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + arguments { + int_literal { + value: 4 + } + } + } + } + } + } + then_block { + statements { + return_statement { + expression { + int_literal { + value: 8 + } + } + } + } + } + } + } + statements { + if_statement { + condition { + operator { + op: Not + arguments { + operator { + op: Eq + arguments { + call { + function { + compound_member_access { + object { + int_literal { + value: 0 + } + } + path { + identifier { + name: "IF" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + arguments { + int_literal { + value: 4 + } + } + } + } + } + } + then_block { + statements { + return_statement { + expression { + int_literal { + value: 9 + } + } + } + } + } + } + } + statements { + if_statement { + condition { + operator { + op: Not + arguments { + operator { + op: Eq + arguments { + call { + function { + compound_member_access { + object { + int_literal { + value: 0 + } + } + path { + identifier { + name: "IM" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + arguments { + int_literal { + value: 5 + } + } + } + } + } + } + then_block { + statements { + return_statement { + expression { + int_literal { + value: 10 + } + } + } + } + } + } + } + statements { + if_statement { + condition { + operator { + op: Not + arguments { + operator { + op: Eq + arguments { + call { + function { + compound_member_access { + object { + int_literal { + value: 0 + } + } + path { + compound_member_access { + object { + int_type_literal { + } + } + path { + identifier { + name: "IM" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + arguments { + int_literal { + value: 5 + } + } + } + } + } + } + then_block { + statements { + return_statement { + expression { + int_literal { + value: 11 + } + } + } + } + } + } + } + statements { + if_statement { + condition { + operator { + op: Not + arguments { + operator { + op: Eq + arguments { + call { + function { + identifier { + name: "i32IF" + } + } + argument { + tuple_literal { + } + } + } + } + arguments { + int_literal { + value: 4 + } + } + } + } + } + } + then_block { + statements { + return_statement { + expression { + int_literal { + value: 12 + } + } + } + } + } + } + } + statements { + if_statement { + condition { + operator { + op: Not + arguments { + operator { + op: Eq + arguments { + call { + function { + compound_member_access { + object { + int_literal { + value: 0 + } + } + path { + identifier { + name: "i32IM" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + arguments { + int_literal { + value: 5 + } + } + } + } + } + } + then_block { + statements { + return_statement { + expression { + int_literal { + value: 13 + } + } + } + } + } + } + } + statements { + return_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/259e262f9509cb8a3e564d29d397ae42670b3c9c b/explorer/fuzzing/fuzzer_corpus/259e262f9509cb8a3e564d29d397ae42670b3c9c new file mode 100644 index 0000000000000..9475c118cff88 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/259e262f9509cb8a3e564d29d397ae42670b3c9c @@ -0,0 +1,309 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "Point" + members { + function { + name: "Origin" + param_pattern { + fields { + binding_pattern { + name: "zero" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + call { + function { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + identifier { + name: "zero" + } + } + } + fields { + name: "y" + expression { + identifier { + name: "zero" + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "GetX" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + call { + function { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_statement { + expression { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + type_params { + fields { + generic_binding { + name: "T" + type { + type_type_literal { + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Origin" + object { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "GetX" + object { + identifier { + name: "p" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/2bbbfc37b0f9199a50d33d34c488d0a197872033 b/explorer/fuzzing/fuzzer_corpus/2bbbfc37b0f9199a50d33d34c488d0a197872033 new file mode 100644 index 0000000000000..a5e8bed521c89 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/2bbbfc37b0f9199a50d33d34c488d0a197872033 @@ -0,0 +1,294 @@ +compilation_unit { + package_statement { + package_name: "Foo" + } + is_api: true + declarations { + interface { + name: "A" + members { + function { + name: "F" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "o" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "X" + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + identifier { + name: "A" + } + } + members { + function { + name: "F" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "o" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "n" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "n" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "n" + object { + identifier { + name: "o" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + identifier { + name: "X" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "w" + type { + expression_pattern { + expression { + identifier { + name: "X" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + statements { + return_statement { + expression { + simple_member_access { + field: "n" + object { + call { + function { + compound_member_access { + object { + identifier { + name: "v" + } + } + path { + simple_member_access { + field: "F" + object { + identifier { + name: "A" + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "w" + } + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/2db6570b8cfc6e5021152d0424c6c068a868355d b/explorer/fuzzing/fuzzer_corpus/2db6570b8cfc6e5021152d0424c6c068a868355d new file mode 100644 index 0000000000000..c59a8917ed9c1 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/2db6570b8cfc6e5021152d0424c6c068a868355d @@ -0,0 +1,766 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Vector" + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + type_params { + fields { + generic_binding { + name: "T" + type { + type_type_literal { + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + interface { + identifier { + name: "Vector" + } + } + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 0 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "AddAndScaleGeneric" + deduced_parameters { + name: "T" + type { + identifier { + name: "Vector" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "s" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "Scale" + object { + call { + function { + simple_member_access { + field: "Add" + object { + identifier { + name: "a" + } + } + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "T" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "s" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 2 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + call { + function { + identifier { + name: "AddAndScaleGeneric" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + int_literal { + value: 5 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "p" + } + } + } + } + arguments { + int_literal { + value: 10 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/2f4d8beb260713992ac947221dff3dc7cdd75096 b/explorer/fuzzing/fuzzer_corpus/2f4d8beb260713992ac947221dff3dc7cdd75096 new file mode 100644 index 0000000000000..3e2ff4e72bcd4 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/2f4d8beb260713992ac947221dff3dc7cdd75096 @@ -0,0 +1,345 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "Shape" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + function { + name: "Origin" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 0 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "GetSetX" + me_pattern { + addr_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "Shape" + } + } + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "old" + type { + auto_pattern { + } + } + } + } + init { + simple_member_access { + field: "x" + object { + operator { + op: Deref + arguments { + identifier { + name: "me" + } + } + } + } + } + } + } + } + statements { + assign { + lhs { + simple_member_access { + field: "x" + object { + operator { + op: Deref + arguments { + identifier { + name: "me" + } + } + } + } + } + } + rhs { + identifier { + name: "x" + } + } + } + } + statements { + return_statement { + expression { + identifier { + name: "old" + } + } + } + } + } + } + } + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Origin" + object { + identifier { + name: "Point" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + auto_pattern { + } + } + } + } + init { + call { + function { + simple_member_access { + field: "GetSetX" + object { + identifier { + name: "p" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 42 + } + } + } + } + } + } + } + } + statements { + if_statement { + condition { + operator { + op: Eq + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "p" + } + } + } + } + arguments { + int_literal { + value: 42 + } + } + } + } + then_block { + statements { + return_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } + statements { + return_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/308d94ff5bf03c10d183bace81bc2f3641a68311 b/explorer/fuzzing/fuzzer_corpus/308d94ff5bf03c10d183bace81bc2f3641a68311 new file mode 100644 index 0000000000000..7eeabe90f6134 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/308d94ff5bf03c10d183bace81bc2f3641a68311 @@ -0,0 +1,245 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "A" + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "A" + } + } + interface { + call { + function { + identifier { + name: "ImplicitAs" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + members { + function { + name: "Convert" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_type_literal { + } + } + } + } + statements { + match { + expression { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + identifier { + name: "a" + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + expression_pattern { + expression { + int_literal { + value: 0 + } + } + } + } + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + statement { + return_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + clauses { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + fields { + expression_pattern { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + statement { + return_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + clauses { + pattern { + expression_pattern { + expression { + tuple_literal { + fields { + int_literal { + value: 1 + } + } + fields { + int_literal { + value: 1 + } + } + } + } + } + } + statement { + return_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + statements { + return_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/350c28992cc3659ed0d99c0cd88376346e9958cc b/explorer/fuzzing/fuzzer_corpus/350c28992cc3659ed0d99c0cd88376346e9958cc new file mode 100644 index 0000000000000..4a21698c6fa45 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/350c28992cc3659ed0d99c0cd88376346e9958cc @@ -0,0 +1,1104 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Vector" + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point1" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Point1" + } + } + interface { + identifier { + name: "Vector" + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point1" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point1" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point1" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point1" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point1" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name: "Point2" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Point2" + } + } + interface { + identifier { + name: "Vector" + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point2" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point2" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point2" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Add + arguments { + operator { + op: Add + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "b" + } + } + } + } + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Add + arguments { + operator { + op: Add + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "b" + } + } + } + } + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point2" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point2" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Mul + arguments { + operator { + op: Mul + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + arguments { + int_literal { + value: 2 + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Mul + arguments { + operator { + op: Mul + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + arguments { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "ScaleGeneric" + deduced_parameters { + name: "U" + type { + identifier { + name: "Vector" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "U" + } + } + } + } + } + } + fields { + binding_pattern { + name: "s" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "U" + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "Scale" + object { + identifier { + name: "c" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "s" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "AddAndScaleGeneric" + deduced_parameters { + name: "T" + type { + identifier { + name: "Vector" + } + } + } + deduced_parameters { + name: "V" + type { + identifier { + name: "Vector" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "V" + } + } + } + } + } + } + fields { + binding_pattern { + name: "s" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + tuple_literal { + fields { + identifier { + name: "T" + } + } + fields { + identifier { + name: "V" + } + } + } + } + } + body { + statements { + return_statement { + expression { + tuple_literal { + fields { + call { + function { + identifier { + name: "ScaleGeneric" + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "Add" + object { + identifier { + name: "a" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "a" + } + } + } + } + } + } + fields { + identifier { + name: "s" + } + } + } + } + } + } + fields { + call { + function { + identifier { + name: "ScaleGeneric" + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "Add" + object { + identifier { + name: "b" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "b" + } + } + } + } + } + } + fields { + identifier { + name: "s" + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "Point1" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 1 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point2" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 2 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 3 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point1" + } + } + } + } + } + } + fields { + binding_pattern { + name: "q" + type { + expression_pattern { + expression { + identifier { + name: "Point2" + } + } + } + } + } + } + } + } + init { + call { + function { + identifier { + name: "AddAndScaleGeneric" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + identifier { + name: "b" + } + } + fields { + int_literal { + value: 5 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Sub + arguments { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "q" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "p" + } + } + } + } + } + } + arguments { + int_literal { + value: 40 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/35a3028fcdb70945c6c7db9e7154b08543f0dc17 b/explorer/fuzzing/fuzzer_corpus/35a3028fcdb70945c6c7db9e7154b08543f0dc17 new file mode 100644 index 0000000000000..76c1a2d9ddd99 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/35a3028fcdb70945c6c7db9e7154b08543f0dc17 @@ -0,0 +1,82 @@ +compilation_unit { + package_statement { + package_name: "Foo" + } + is_api: true + declarations { + function { + name: "F" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + compound_member_access { + object { + int_literal { + value: 42 + } + } + path { + identifier { + name: "F" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + return_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/3ec79d5d498edae7c9cc422fd5087a7dedf6394c b/explorer/fuzzing/fuzzer_corpus/3ec79d5d498edae7c9cc422fd5087a7dedf6394c new file mode 100644 index 0000000000000..9225f5c9d9da9 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/3ec79d5d498edae7c9cc422fd5087a7dedf6394c @@ -0,0 +1,567 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Addable" + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "k" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + int_type_literal { + } + } + interface { + identifier { + name: "Addable" + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "k" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_statement { + expression { + operator { + op: Add + arguments { + identifier { + name: "me" + } + } + arguments { + identifier { + name: "k" + } + } + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name: "Class" + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name: "GenericClass" + members { + variable { + binding { + name: "m" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + members { + function { + name: "Get" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "Add" + object { + simple_member_access { + field: "m" + object { + identifier { + name: "me" + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "n" + } + } + } + } + } + } + } + } + } + } + } + type_params { + fields { + generic_binding { + name: "T" + type { + identifier { + name: "Addable" + } + } + } + } + } + } + } + declarations { + alias { + name: "ClassAlias" + target { + identifier { + name: "Class" + } + } + } + } + declarations { + alias { + name: "GenericClassAlias" + target { + identifier { + name: "GenericClass" + } + } + } + } + declarations { + alias { + name: "ClassSpecializationAlias" + target { + call { + function { + identifier { + name: "GenericClassAlias" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "Class" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "ClassAlias" + } + } + } + } + } + } + init { + identifier { + name: "a" + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "GenericClass" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "m" + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "d" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "GenericClassAlias" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + identifier { + name: "c" + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "e" + type { + expression_pattern { + expression { + identifier { + name: "ClassSpecializationAlias" + } + } + } + } + } + } + init { + identifier { + name: "c" + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Add + arguments { + operator { + op: Add + arguments { + operator { + op: Mul + arguments { + int_literal { + value: 100 + } + } + arguments { + simple_member_access { + field: "n" + object { + identifier { + name: "b" + } + } + } + } + } + } + arguments { + operator { + op: Mul + arguments { + int_literal { + value: 10 + } + } + arguments { + call { + function { + simple_member_access { + field: "Get" + object { + identifier { + name: "d" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + arguments { + call { + function { + simple_member_access { + field: "Get" + object { + identifier { + name: "e" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/409a3e4b8dcbe38b5a8ca74e701205708d8c05a4 b/explorer/fuzzing/fuzzer_corpus/409a3e4b8dcbe38b5a8ca74e701205708d8c05a4 new file mode 100644 index 0000000000000..7bd055ac781fd --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/409a3e4b8dcbe38b5a8ca74e701205708d8c05a4 @@ -0,0 +1,571 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Vector" + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Point" + } + } + interface { + identifier { + name: "Vector" + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "AddAndScaleGeneric" + deduced_parameters { + name: "T" + type { + identifier { + name: "Vector" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "s" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "m" + type { + auto_pattern { + } + } + } + } + init { + simple_member_access { + field: "Add" + object { + identifier { + name: "a" + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "n" + type { + auto_pattern { + } + } + } + } + init { + simple_member_access { + field: "Scale" + object { + call { + function { + identifier { + name: "m" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + call { + function { + identifier { + name: "n" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "s" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 0 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 2 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 3 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + identifier { + name: "AddAndScaleGeneric" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + identifier { + name: "b" + } + } + fields { + int_literal { + value: 3 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "p" + } + } + } + } + arguments { + int_literal { + value: 6 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/43a5f1124cf3bf76c63cd184ba30cb654a790ff7 b/explorer/fuzzing/fuzzer_corpus/43a5f1124cf3bf76c63cd184ba30cb654a790ff7 new file mode 100644 index 0000000000000..e180f9000181a --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/43a5f1124cf3bf76c63cd184ba30cb654a790ff7 @@ -0,0 +1,505 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "AddWith" + members { + function { + name: "Op" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Point" + } + } + interface { + call { + function { + identifier { + name: "AddWith" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "Self" + } + } + } + } + } + } + members { + function { + name: "Op" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "DoAddGeneric" + deduced_parameters { + name: "T" + type { + type_type_literal { + } + } + } + deduced_parameters { + name: "U" + type { + call { + function { + identifier { + name: "AddWith" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "U" + } + } + } + } + } + } + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "U" + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "Op" + object { + identifier { + name: "a" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 2 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 4 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + identifier { + name: "DoAddGeneric" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + identifier { + name: "b" + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Sub + arguments { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "p" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "p" + } + } + } + } + } + } + arguments { + int_literal { + value: 3 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/44032fb64eaa572d1e2ae4d500db23ae32355380 b/explorer/fuzzing/fuzzer_corpus/44032fb64eaa572d1e2ae4d500db23ae32355380 new file mode 100644 index 0000000000000..46fbdae0a5fa6 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/44032fb64eaa572d1e2ae4d500db23ae32355380 @@ -0,0 +1,669 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Vector" + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "Point" + } + } + interface { + identifier { + name: "Vector" + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "AddAndScaleGeneric" + deduced_parameters { + name: "T" + type { + identifier { + name: "Vector" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "s" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "m" + type { + auto_pattern { + } + } + } + } + init { + simple_member_access { + field: "Add" + object { + identifier { + name: "a" + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "n" + type { + auto_pattern { + } + } + } + } + init { + simple_member_access { + field: "Scale" + object { + call { + function { + identifier { + name: "m" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + call { + function { + identifier { + name: "n" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "s" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 1 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 4 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 2 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 3 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + identifier { + name: "AddAndScaleGeneric" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + identifier { + name: "b" + } + } + fields { + int_literal { + value: 5 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "p" + } + } + } + } + arguments { + int_literal { + value: 15 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/457c811489db1e3f987633ce1fb2dce7d984fb66 b/explorer/fuzzing/fuzzer_corpus/457c811489db1e3f987633ce1fb2dce7d984fb66 new file mode 100644 index 0000000000000..a9015f3ddfab7 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/457c811489db1e3f987633ce1fb2dce7d984fb66 @@ -0,0 +1,305 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "Wrap" + members { + variable { + binding { + name: "v" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + type_params { + fields { + generic_binding { + name: "T" + type { + type_type_literal { + } + } + } + } + } + } + } + declarations { + function { + name: "MakeWrap" + deduced_parameters { + name: "T" + type { + type_type_literal { + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "Wrap" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "v" + expression { + identifier { + name: "x" + } + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + call { + function { + identifier { + name: "Wrap" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + interface { + call { + function { + identifier { + name: "ImplicitAs" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + members { + function { + name: "Convert" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_statement { + expression { + simple_member_access { + field: "v" + object { + identifier { + name: "me" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + init { + int_literal { + value: 1 + } + } + } + } + statements { + continuation { + name: "k" + body { + statements { + assign { + lhs { + identifier { + name: "n" + } + } + rhs { + operator { + op: Add + arguments { + identifier { + name: "n" + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + statements { + assign { + lhs { + identifier { + name: "n" + } + } + rhs { + int_literal { + value: 2 + } + } + } + } + statements { + run { + argument { + call { + function { + identifier { + name: "MakeWrap" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "k" + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + identifier { + name: "n" + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/4ce3a6280cb42032b421b2ada1018f692720e17d b/explorer/fuzzing/fuzzer_corpus/4ce3a6280cb42032b421b2ada1018f692720e17d new file mode 100644 index 0000000000000..4c11895de5bee --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/4ce3a6280cb42032b421b2ada1018f692720e17d @@ -0,0 +1,402 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "IntLike" + members { + function { + name: "Convert" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + int_type_literal { + } + } + interface { + identifier { + name: "IntLike" + } + } + members { + function { + name: "Convert" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + identifier { + name: "me" + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "add" + deduced_parameters { + name: "T" + type { + identifier { + name: "IntLike" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + struct_type_literal { + fields { + name: "a" + expression { + identifier { + name: "T" + } + } + } + fields { + name: "b" + expression { + tuple_literal { + fields { + struct_type_literal { + fields { + name: "m" + expression { + int_type_literal { + } + } + } + fields { + name: "n" + expression { + identifier { + name: "T" + } + } + } + } + } + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + operator { + op: Add + arguments { + operator { + op: Add + arguments { + operator { + op: Add + arguments { + operator { + op: Mul + arguments { + int_literal { + value: 1000 + } + } + arguments { + call { + function { + simple_member_access { + field: "Convert" + object { + simple_member_access { + field: "a" + object { + identifier { + name: "x" + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + arguments { + operator { + op: Mul + arguments { + int_literal { + value: 100 + } + } + arguments { + simple_member_access { + field: "m" + object { + index { + object { + simple_member_access { + field: "b" + object { + identifier { + name: "x" + } + } + } + } + offset { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + arguments { + operator { + op: Mul + arguments { + int_literal { + value: 10 + } + } + arguments { + call { + function { + simple_member_access { + field: "Convert" + object { + simple_member_access { + field: "n" + object { + index { + object { + simple_member_access { + field: "b" + object { + identifier { + name: "x" + } + } + } + } + offset { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + arguments { + index { + object { + simple_member_access { + field: "b" + object { + identifier { + name: "x" + } + } + } + } + offset { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + identifier { + name: "add" + } + } + argument { + tuple_literal { + fields { + struct_literal { + fields { + name: "b" + expression { + tuple_literal { + fields { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 1 + } + } + } + fields { + name: "m" + expression { + int_literal { + value: 2 + } + } + } + } + } + fields { + int_literal { + value: 3 + } + } + } + } + } + fields { + name: "a" + expression { + int_literal { + value: 4 + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/4ee491109d08f78764e3ed9a59f36521e348650b b/explorer/fuzzing/fuzzer_corpus/4ee491109d08f78764e3ed9a59f36521e348650b new file mode 100644 index 0000000000000..7af3c68e5e740 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/4ee491109d08f78764e3ed9a59f36521e348650b @@ -0,0 +1,120 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "C" + members { + function { + name: "F" + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + members { + function { + name: "G" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "f" + type { + auto_pattern { + } + } + } + } + init { + simple_member_access { + field: "F" + object { + identifier { + name: "C" + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "g" + type { + auto_pattern { + } + } + } + } + init { + simple_member_access { + field: "G" + object { + identifier { + name: "C" + } + } + } + } + } + } + statements { + return_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/51a6ff8051dffb6bc7c57b437a526d8f1ed37a57 b/explorer/fuzzing/fuzzer_corpus/51a6ff8051dffb6bc7c57b437a526d8f1ed37a57 new file mode 100644 index 0000000000000..a3aa89be00564 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/51a6ff8051dffb6bc7c57b437a526d8f1ed37a57 @@ -0,0 +1,223 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "Point" + members { + function { + name: "Origin" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 0 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "SetX" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + statements { + assign { + lhs { + identifier { + name: "x" + } + } + rhs { + int_literal { + value: 10 + } + } + } + } + } + } + } + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Origin" + object { + identifier { + name: "Point" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + simple_member_access { + field: "SetX" + object { + identifier { + name: "p" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 42 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/536c060cc8df53b0132be40dbbc67f1df1775bac b/explorer/fuzzing/fuzzer_corpus/536c060cc8df53b0132be40dbbc67f1df1775bac new file mode 100644 index 0000000000000..091ee9cbd93d3 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/536c060cc8df53b0132be40dbbc67f1df1775bac @@ -0,0 +1,325 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "Point" + members { + function { + name: "Origin" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 0 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "GetSetX" + me_pattern { + addr_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "Point" + } + } + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "old" + type { + auto_pattern { + } + } + } + } + init { + simple_member_access { + field: "x" + object { + operator { + op: Deref + arguments { + identifier { + name: "me" + } + } + } + } + } + } + } + } + statements { + assign { + lhs { + simple_member_access { + field: "x" + object { + operator { + op: Deref + arguments { + identifier { + name: "me" + } + } + } + } + } + } + rhs { + identifier { + name: "x" + } + } + } + } + statements { + return_statement { + expression { + identifier { + name: "old" + } + } + } + } + } + } + } + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Origin" + object { + identifier { + name: "Point" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + auto_pattern { + } + } + } + } + init { + call { + function { + simple_member_access { + field: "GetSetX" + object { + identifier { + name: "p" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 42 + } + } + } + } + } + } + } + } + statements { + if_statement { + condition { + operator { + op: Eq + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "p" + } + } + } + } + arguments { + int_literal { + value: 42 + } + } + } + } + then_block { + statements { + return_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } + statements { + return_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/538556cd683ca838d1ffefb154cda7a804b3eafe b/explorer/fuzzing/fuzzer_corpus/538556cd683ca838d1ffefb154cda7a804b3eafe new file mode 100644 index 0000000000000..3f4dec606dc77 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/538556cd683ca838d1ffefb154cda7a804b3eafe @@ -0,0 +1,270 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "Point" + members { + function { + name: "Origin" + param_pattern { + fields { + binding_pattern { + name: "zero" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + identifier { + name: "zero" + } + } + } + fields { + name: "y" + expression { + identifier { + name: "zero" + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "GetX" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_statement { + expression { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + type_params { + fields { + generic_binding { + name: "T" + type { + type_type_literal { + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Origin" + object { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "GetX" + object { + identifier { + name: "p" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/55ccba2998142de2e42b6f1daf02d8753579f38e b/explorer/fuzzing/fuzzer_corpus/55ccba2998142de2e42b6f1daf02d8753579f38e new file mode 100644 index 0000000000000..0a9b7a38931b5 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/55ccba2998142de2e42b6f1daf02d8753579f38e @@ -0,0 +1,411 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Vector" + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "AddAndScaleGeneric" + deduced_parameters { + name: "T" + type { + identifier { + name: "Vector" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "s" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "Scale" + object { + call { + function { + simple_member_access { + field: "Add" + object { + identifier { + name: "a" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "b" + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "s" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 0 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 2 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 3 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + identifier { + name: "AddAndScaleGeneric" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + identifier { + name: "b" + } + } + fields { + int_literal { + value: 3 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "p" + } + } + } + } + arguments { + int_literal { + value: 6 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/5def149b950eae9d5fae3e3fadbdfc1e0d322cbc b/explorer/fuzzing/fuzzer_corpus/5def149b950eae9d5fae3e3fadbdfc1e0d322cbc new file mode 100644 index 0000000000000..348a7ea864e88 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/5def149b950eae9d5fae3e3fadbdfc1e0d322cbc @@ -0,0 +1,161 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "C" + members { + function { + name: "F" + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + members { + function { + name: "G" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + } + } + declarations { + function { + name: "H" + deduced_parameters { + name: "T" + type { + type_type_literal { + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Omitted + } + body { + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "H" + } + } + argument { + tuple_literal { + fields { + simple_member_access { + field: "F" + object { + identifier { + name: "C" + } + } + } + } + } + } + } + } + } + } + statements { + expression_statement { + expression { + call { + function { + identifier { + name: "H" + } + } + argument { + tuple_literal { + fields { + simple_member_access { + field: "G" + object { + identifier { + name: "C" + } + } + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/5fc78caa03024255c5c7015e6e3c0bc97f5a4c1e b/explorer/fuzzing/fuzzer_corpus/5fc78caa03024255c5c7015e6e3c0bc97f5a4c1e new file mode 100644 index 0000000000000..d57406441b310 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/5fc78caa03024255c5c7015e6e3c0bc97f5a4c1e @@ -0,0 +1,805 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Number" + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + type_params { + fields { + generic_binding { + name: "T" + type { + identifier { + name: "Number" + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + int_type_literal { + } + } + interface { + identifier { + name: "Number" + } + } + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + operator { + op: Add + arguments { + identifier { + name: "me" + } + } + arguments { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "U" + } + } + } + } + } + } + interface { + identifier { + name: "Number" + } + } + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "U" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + fields { + name: "y" + expression { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "U" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + call { + function { + simple_member_access { + field: "Add" + object { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + } + } + argument { + tuple_literal { + fields { + simple_member_access { + field: "x" + object { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + fields { + name: "y" + expression { + call { + function { + simple_member_access { + field: "Add" + object { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + } + } + argument { + tuple_literal { + fields { + simple_member_access { + field: "y" + object { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Sum" + deduced_parameters { + name: "E" + type { + identifier { + name: "Number" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "E" + } + } + } + } + } + } + fields { + binding_pattern { + name: "y" + type { + expression_pattern { + expression { + identifier { + name: "E" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "E" + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "total" + type { + expression_pattern { + expression { + identifier { + name: "E" + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "E" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + assign { + lhs { + identifier { + name: "total" + } + } + rhs { + call { + function { + simple_member_access { + field: "Add" + object { + identifier { + name: "total" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "x" + } + } + } + } + } + } + } + } + statements { + assign { + lhs { + identifier { + name: "total" + } + } + rhs { + call { + function { + simple_member_access { + field: "Add" + object { + identifier { + name: "total" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "y" + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + identifier { + name: "total" + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 1 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "q" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 4 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 3 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "r" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + call { + function { + identifier { + name: "Sum" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "p" + } + } + fields { + identifier { + name: "q" + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "r" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "r" + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/60469f199bd3244e105b0446c25cc23b6a768eae b/explorer/fuzzing/fuzzer_corpus/60469f199bd3244e105b0446c25cc23b6a768eae new file mode 100644 index 0000000000000..e89e35c75b453 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/60469f199bd3244e105b0446c25cc23b6a768eae @@ -0,0 +1,805 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Number" + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + type_params { + fields { + generic_binding { + name: "T" + type { + identifier { + name: "Number" + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + int_type_literal { + } + } + interface { + identifier { + name: "Number" + } + } + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + operator { + op: Add + arguments { + identifier { + name: "me" + } + } + arguments { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "U" + } + } + } + } + } + } + interface { + identifier { + name: "Number" + } + } + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "U" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + fields { + name: "y" + expression { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "U" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + call { + function { + simple_member_access { + field: "Add" + object { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + } + } + argument { + tuple_literal { + fields { + simple_member_access { + field: "x" + object { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + fields { + name: "y" + expression { + call { + function { + simple_member_access { + field: "Add" + object { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + } + } + argument { + tuple_literal { + fields { + simple_member_access { + field: "y" + object { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Sum" + deduced_parameters { + name: "E" + type { + identifier { + name: "Number" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "E" + } + } + } + } + } + } + fields { + binding_pattern { + name: "y" + type { + expression_pattern { + expression { + identifier { + name: "E" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "E" + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "total" + type { + expression_pattern { + expression { + identifier { + name: "E" + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "E" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + assign { + lhs { + identifier { + name: "total" + } + } + rhs { + call { + function { + simple_member_access { + field: "Add" + object { + identifier { + name: "total" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "x" + } + } + } + } + } + } + } + } + statements { + assign { + lhs { + identifier { + name: "total" + } + } + rhs { + call { + function { + simple_member_access { + field: "Add" + object { + identifier { + name: "total" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "y" + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + identifier { + name: "total" + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 1 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "q" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 4 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 3 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "r" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + call { + function { + identifier { + name: "Sum" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "p" + } + } + fields { + identifier { + name: "q" + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "r" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "r" + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/62c7aa55a12ef5ad4a7cec26ea7c3f0ed82ae24a b/explorer/fuzzing/fuzzer_corpus/62c7aa55a12ef5ad4a7cec26ea7c3f0ed82ae24a new file mode 100644 index 0000000000000..ef2333bea6a76 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/62c7aa55a12ef5ad4a7cec26ea7c3f0ed82ae24a @@ -0,0 +1,694 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Vector" + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + type_params { + fields { + generic_binding { + name: "T" + type { + type_type_literal { + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + interface { + identifier { + name: "Vector" + } + } + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 0 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "AddAndScaleGeneric" + deduced_parameters { + name: "T" + type { + identifier { + name: "Vector" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "s" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "Scale" + object { + call { + function { + simple_member_access { + field: "Add" + object { + identifier { + name: "a" + } + } + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "T" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "s" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 2 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + call { + function { + identifier { + name: "AddAndScaleGeneric" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + int_literal { + value: 5 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "p" + } + } + } + } + arguments { + int_literal { + value: 10 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/63979179f0b4279dbf7a98a3a7b9837393d43e8a b/explorer/fuzzing/fuzzer_corpus/63979179f0b4279dbf7a98a3a7b9837393d43e8a new file mode 100644 index 0000000000000..adec5eb19b21d --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/63979179f0b4279dbf7a98a3a7b9837393d43e8a @@ -0,0 +1,257 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "Point" + members { + function { + name: "Origin" + param_pattern { + fields { + binding_pattern { + name: "zero" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + identifier { + name: "zero" + } + } + } + fields { + name: "y" + expression { + identifier { + name: "zero" + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "GetX" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_statement { + expression { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + type_params { + fields { + generic_binding { + name: "T" + type { + type_type_literal { + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Origin" + object { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "GetX" + object { + identifier { + name: "p" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/659e20bff50e0abe4f7d58e8e0b739ad2a5048b9 b/explorer/fuzzing/fuzzer_corpus/659e20bff50e0abe4f7d58e8e0b739ad2a5048b9 new file mode 100644 index 0000000000000..eba6eb0df0a19 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/659e20bff50e0abe4f7d58e8e0b739ad2a5048b9 @@ -0,0 +1,403 @@ +compilation_unit { + package_statement { + package_name: "Foo" + } + is_api: true + declarations { + interface { + name: "HasF" + members { + function { + name: "F" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "o" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "X" + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + identifier { + name: "HasF" + } + } + members { + function { + name: "F" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "o" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "n" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "n" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "n" + object { + identifier { + name: "o" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name: "Y" + members { + variable { + binding { + name: "m" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + call { + function { + identifier { + name: "ImplicitAs" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "X" + } + } + } + } + } + } + members { + function { + name: "Convert" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "X" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "n" + expression { + simple_member_access { + field: "m" + object { + identifier { + name: "me" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "X" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "y" + type { + expression_pattern { + expression { + identifier { + name: "Y" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "m" + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + statements { + return_statement { + expression { + simple_member_access { + field: "n" + object { + call { + function { + compound_member_access { + object { + identifier { + name: "y" + } + } + path { + compound_member_access { + object { + identifier { + name: "X" + } + } + path { + simple_member_access { + field: "F" + object { + identifier { + name: "HasF" + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "x" + } + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/65c24d040bbc26b5e1fea735ddf1755392471a18 b/explorer/fuzzing/fuzzer_corpus/65c24d040bbc26b5e1fea735ddf1755392471a18 new file mode 100644 index 0000000000000..292e835e87531 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/65c24d040bbc26b5e1fea735ddf1755392471a18 @@ -0,0 +1,614 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Number" + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + type_params { + fields { + generic_binding { + name: "T" + type { + identifier { + name: "Number" + } + } + } + } + } + } + } + declarations { + function { + name: "Origin" + deduced_parameters { + name: "U" + type { + identifier { + name: "Number" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + identifier { + name: "U" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "U" + } + } + } + } + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "U" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + fields { + name: "y" + expression { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "U" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Clone" + deduced_parameters { + name: "U" + type { + identifier { + name: "Number" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "U" + } + } + } + } + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "U" + } + } + } + } + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + simple_member_access { + field: "x" + object { + identifier { + name: "other" + } + } + } + } + } + fields { + name: "y" + expression { + simple_member_access { + field: "y" + object { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "SumXY" + deduced_parameters { + name: "U" + type { + identifier { + name: "Number" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "U" + } + } + } + } + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "U" + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "Add" + object { + simple_member_access { + field: "x" + object { + identifier { + name: "other" + } + } + } + } + } + } + argument { + tuple_literal { + fields { + simple_member_access { + field: "y" + object { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + int_type_literal { + } + } + interface { + identifier { + name: "Number" + } + } + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + operator { + op: Add + arguments { + identifier { + name: "me" + } + } + arguments { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + call { + function { + identifier { + name: "Origin" + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + call { + function { + identifier { + name: "SumXY" + } + } + argument { + tuple_literal { + fields { + call { + function { + identifier { + name: "Clone" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "p" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/71035d013bdc57394db132778f7934164475cff1 b/explorer/fuzzing/fuzzer_corpus/71035d013bdc57394db132778f7934164475cff1 new file mode 100644 index 0000000000000..f4ccbb5fdc89a --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/71035d013bdc57394db132778f7934164475cff1 @@ -0,0 +1,233 @@ +compilation_unit { + package_statement { + package_name: "Foo" + } + is_api: true + declarations { + class_declaration { + name: "X" + members { + function { + name: "F" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "o" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "n" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "n" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "n" + object { + identifier { + name: "o" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + identifier { + name: "X" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "w" + type { + expression_pattern { + expression { + identifier { + name: "X" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + statements { + return_statement { + expression { + compound_member_access { + object { + call { + function { + compound_member_access { + object { + identifier { + name: "v" + } + } + path { + simple_member_access { + field: "F" + object { + identifier { + name: "X" + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "w" + } + } + } + } + } + } + path { + simple_member_access { + field: "n" + object { + identifier { + name: "X" + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/74bd01b6ca01991c40cb7e2129d34602c5807542 b/explorer/fuzzing/fuzzer_corpus/74bd01b6ca01991c40cb7e2129d34602c5807542 new file mode 100644 index 0000000000000..d4788a7add735 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/74bd01b6ca01991c40cb7e2129d34602c5807542 @@ -0,0 +1,418 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Vector" + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + function { + name: "ScaleGeneric" + deduced_parameters { + name: "T" + type { + identifier { + name: "Vector" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "s" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "Scale" + object { + identifier { + name: "a" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "s" + } + } + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Point" + } + } + interface { + identifier { + name: "Vector" + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 3 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + identifier { + name: "ScaleGeneric" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "b" + } + } + } + } + arguments { + int_literal { + value: 6 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/75c68060eb8633b81c8c183d8e52b386a6f40b6e b/explorer/fuzzing/fuzzer_corpus/75c68060eb8633b81c8c183d8e52b386a6f40b6e new file mode 100644 index 0000000000000..b82122b280db3 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/75c68060eb8633b81c8c183d8e52b386a6f40b6e @@ -0,0 +1,857 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Number" + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + type_params { + fields { + generic_binding { + name: "T" + type { + identifier { + name: "Number" + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + int_type_literal { + } + } + interface { + identifier { + name: "Number" + } + } + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + operator { + op: Add + arguments { + identifier { + name: "me" + } + } + arguments { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "U" + } + } + } + } + } + } + interface { + identifier { + name: "Number" + } + } + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "U" + } + } + } + } + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "U" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + fields { + name: "y" + expression { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "U" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "U" + } + } + } + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "U" + } + } + } + } + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "U" + } + } + } + } + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + call { + function { + simple_member_access { + field: "Add" + object { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + } + } + argument { + tuple_literal { + fields { + simple_member_access { + field: "x" + object { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + fields { + name: "y" + expression { + call { + function { + simple_member_access { + field: "Add" + object { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + } + } + argument { + tuple_literal { + fields { + simple_member_access { + field: "y" + object { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Sum" + deduced_parameters { + name: "E" + type { + identifier { + name: "Number" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "E" + } + } + } + } + } + } + fields { + binding_pattern { + name: "y" + type { + expression_pattern { + expression { + identifier { + name: "E" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "E" + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "total" + type { + expression_pattern { + expression { + identifier { + name: "E" + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "E" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + assign { + lhs { + identifier { + name: "total" + } + } + rhs { + call { + function { + simple_member_access { + field: "Add" + object { + identifier { + name: "total" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "x" + } + } + } + } + } + } + } + } + statements { + assign { + lhs { + identifier { + name: "total" + } + } + rhs { + call { + function { + simple_member_access { + field: "Add" + object { + identifier { + name: "total" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "y" + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + identifier { + name: "total" + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 1 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "q" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 4 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 3 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "r" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + call { + function { + identifier { + name: "Sum" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "p" + } + } + fields { + identifier { + name: "q" + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "r" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "r" + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/76e8a4678c5aa0cfcce078571739a299702810b7 b/explorer/fuzzing/fuzzer_corpus/76e8a4678c5aa0cfcce078571739a299702810b7 new file mode 100644 index 0000000000000..be2804ee45a03 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/76e8a4678c5aa0cfcce078571739a299702810b7 @@ -0,0 +1,588 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Number" + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + function { + name: "Origin" + param_pattern { + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "T" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + fields { + name: "y" + expression { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "T" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Clone" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + } + fields { + name: "y" + expression { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "SumXY" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "Add" + object { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + } + } + argument { + tuple_literal { + fields { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + type_params { + fields { + generic_binding { + name: "T" + type { + identifier { + name: "Number" + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + int_type_literal { + } + } + interface { + identifier { + name: "Number" + } + } + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + operator { + op: Add + arguments { + identifier { + name: "me" + } + } + arguments { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Origin" + object { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "SumXY" + object { + call { + function { + simple_member_access { + field: "Clone" + object { + identifier { + name: "p" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/91e906e0d538a96c1414d805872f0a3159529471 b/explorer/fuzzing/fuzzer_corpus/91e906e0d538a96c1414d805872f0a3159529471 new file mode 100644 index 0000000000000..7e4213c1d62a4 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/91e906e0d538a96c1414d805872f0a3159529471 @@ -0,0 +1,293 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "Point" + members { + function { + name: "Origin" + param_pattern { + fields { + binding_pattern { + name: "zero" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + identifier { + name: "zero" + } + } + } + fields { + name: "y" + expression { + identifier { + name: "zero" + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "GetX" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_statement { + expression { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + type_params { + fields { + generic_binding { + name: "T" + type { + type_type_literal { + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Origin" + object { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "GetX" + object { + identifier { + name: "p" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/975fcd972f9644c64177a30109d358cde488ec9c b/explorer/fuzzing/fuzzer_corpus/975fcd972f9644c64177a30109d358cde488ec9c new file mode 100644 index 0000000000000..acf98fc9f0d5e --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/975fcd972f9644c64177a30109d358cde488ec9c @@ -0,0 +1,324 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "B" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + function { + name: "GetSetX" + me_pattern { + addr_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + operator { + op: Ptr + arguments { + identifier { + name: "Self" + } + } + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "oldX" + type { + auto_pattern { + } + } + } + } + init { + simple_member_access { + field: "x" + object { + operator { + op: Deref + arguments { + identifier { + name: "me" + } + } + } + } + } + } + } + } + statements { + assign { + lhs { + simple_member_access { + field: "x" + object { + operator { + op: Deref + arguments { + identifier { + name: "me" + } + } + } + } + } + } + rhs { + identifier { + name: "x" + } + } + } + } + statements { + return_statement { + expression { + identifier { + name: "oldX" + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name: "A" + members { + variable { + binding { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "B" + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "B" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "b" + expression { + identifier { + name: "b" + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + auto_pattern { + } + } + } + } + init { + call { + function { + simple_member_access { + field: "GetSetX" + object { + simple_member_access { + field: "b" + object { + identifier { + name: "a" + } + } + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 42 + } + } + } + } + } + } + } + } + statements { + if_statement { + condition { + operator { + op: Eq + arguments { + simple_member_access { + field: "x" + object { + simple_member_access { + field: "b" + object { + identifier { + name: "a" + } + } + } + } + } + } + arguments { + int_literal { + value: 42 + } + } + } + } + then_block { + statements { + return_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } + statements { + return_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/988b50fcd2641207a813cbb1fd6d8e5b3c82b07b b/explorer/fuzzing/fuzzer_corpus/988b50fcd2641207a813cbb1fd6d8e5b3c82b07b new file mode 100644 index 0000000000000..e41d424e0aafe --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/988b50fcd2641207a813cbb1fd6d8e5b3c82b07b @@ -0,0 +1,686 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Vector" + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Point" + } + } + interface { + identifier { + name: "Vector" + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "AddAndScaleGeneric" + deduced_parameters { + name: "T" + type { + identifier { + name: "Vector" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "t" + type { + expression_pattern { + expression { + tuple_literal { + fields { + identifier { + name: "T" + } + } + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + fields { + binding_pattern { + name: "s" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "m" + type { + auto_pattern { + } + } + } + } + init { + simple_member_access { + field: "Add" + object { + index { + object { + identifier { + name: "t" + } + } + offset { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "n" + type { + auto_pattern { + } + } + } + } + init { + simple_member_access { + field: "Scale" + object { + call { + function { + identifier { + name: "m" + } + } + argument { + tuple_literal { + fields { + index { + object { + identifier { + name: "t" + } + } + offset { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + call { + function { + identifier { + name: "n" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "s" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 1 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 2 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 3 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + identifier { + name: "AddAndScaleGeneric" + } + } + argument { + tuple_literal { + fields { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + identifier { + name: "b" + } + } + } + } + fields { + int_literal { + value: 5 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "p" + } + } + } + } + arguments { + int_literal { + value: 15 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/9a73b722edc48fc49e85c9221d5cdd6423f8f38a b/explorer/fuzzing/fuzzer_corpus/9a73b722edc48fc49e85c9221d5cdd6423f8f38a new file mode 100644 index 0000000000000..f229e911d0b2a --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/9a73b722edc48fc49e85c9221d5cdd6423f8f38a @@ -0,0 +1,283 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "Point" + members { + function { + name: "Origin" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 0 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "GetX" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + } + } + } + } + } + members { + function { + name: "GetXY" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + tuple_literal { + fields { + int_type_literal { + } + } + fields { + int_type_literal { + } + } + } + } + } + body { + statements { + return_statement { + expression { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "GetX" + object { + identifier { + name: "me" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + fields { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Origin" + object { + identifier { + name: "Point" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + return_statement { + expression { + index { + object { + call { + function { + simple_member_access { + field: "GetXY" + object { + identifier { + name: "p" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + offset { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/9ada7039985bcf2aeea353a2e74e93cfdc8b432e b/explorer/fuzzing/fuzzer_corpus/9ada7039985bcf2aeea353a2e74e93cfdc8b432e new file mode 100644 index 0000000000000..e039dbce1a985 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/9ada7039985bcf2aeea353a2e74e93cfdc8b432e @@ -0,0 +1,126 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "C" + members { + function { + name: "F" + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + members { + function { + name: "G" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Omitted + } + body { + } + } + } + } + } + declarations { + function { + name: "ReturnF" + param_pattern { + } + return_term { + kind: Auto + } + body { + statements { + return_statement { + expression { + simple_member_access { + field: "F" + object { + identifier { + name: "C" + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "ReturnG" + param_pattern { + } + return_term { + kind: Auto + } + body { + statements { + return_statement { + expression { + simple_member_access { + field: "G" + object { + identifier { + name: "C" + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/a88508d94032d0429d1cba11c1df90deb142c155 b/explorer/fuzzing/fuzzer_corpus/a88508d94032d0429d1cba11c1df90deb142c155 new file mode 100644 index 0000000000000..5634f6b14f11e --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/a88508d94032d0429d1cba11c1df90deb142c155 @@ -0,0 +1,200 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "Point" + members { + function { + name: "Origin" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 0 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "GetX" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Origin" + object { + identifier { + name: "Point" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "GetX" + object { + identifier { + name: "p" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/ab1a6d3ba7f35f95cd5aafdbf1f4b031de1a0f6b b/explorer/fuzzing/fuzzer_corpus/ab1a6d3ba7f35f95cd5aafdbf1f4b031de1a0f6b new file mode 100644 index 0000000000000..7ed752845ec4e --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/ab1a6d3ba7f35f95cd5aafdbf1f4b031de1a0f6b @@ -0,0 +1,669 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Vector" + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "Point" + } + } + interface { + identifier { + name: "Vector" + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "AddAndScaleGeneric" + deduced_parameters { + name: "T" + type { + identifier { + name: "Vector" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "s" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "m" + type { + auto_pattern { + } + } + } + } + init { + simple_member_access { + field: "Add" + object { + identifier { + name: "a" + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "n" + type { + auto_pattern { + } + } + } + } + init { + simple_member_access { + field: "Scale" + object { + call { + function { + identifier { + name: "m" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + call { + function { + identifier { + name: "n" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "s" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 1 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 4 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 2 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 3 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + identifier { + name: "AddAndScaleGeneric" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + identifier { + name: "b" + } + } + fields { + int_literal { + value: 5 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "p" + } + } + } + } + arguments { + int_literal { + value: 15 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/ad532018fa2a099d303e2439b0c39557aecf8e00 b/explorer/fuzzing/fuzzer_corpus/ad532018fa2a099d303e2439b0c39557aecf8e00 new file mode 100644 index 0000000000000..a3f99dcfda8b6 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/ad532018fa2a099d303e2439b0c39557aecf8e00 @@ -0,0 +1,110 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "A" + members { + function { + name: "F" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_type_literal { + } + } + } + } + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "F" + object { + identifier { + name: "a" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/ad6c39ea6ec9ed5867500173d2aaa1200bbc06a6 b/explorer/fuzzing/fuzzer_corpus/ad6c39ea6ec9ed5867500173d2aaa1200bbc06a6 new file mode 100644 index 0000000000000..f1e2fc3879a7a --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/ad6c39ea6ec9ed5867500173d2aaa1200bbc06a6 @@ -0,0 +1,174 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "A" + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + int_type_literal { + } + } + interface { + call { + function { + identifier { + name: "ImplicitAs" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "A" + } + } + } + } + } + } + members { + function { + name: "Convert" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "A" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "n" + expression { + identifier { + name: "me" + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + statements { + assign { + lhs { + identifier { + name: "a" + } + } + rhs { + int_literal { + value: 1 + } + } + } + } + statements { + return_statement { + expression { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/b2bb0268ca91b380d18d8b4e26f8188830ad584b b/explorer/fuzzing/fuzzer_corpus/b2bb0268ca91b380d18d8b4e26f8188830ad584b new file mode 100644 index 0000000000000..67870488109da --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/b2bb0268ca91b380d18d8b4e26f8188830ad584b @@ -0,0 +1,164 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "Point" + members { + function { + name: "Origin" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 0 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "GetX" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "GetX" + object { + identifier { + name: "Point" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/b3be1b28b64d4a3b2da9d7a2da48e4094e7102bf b/explorer/fuzzing/fuzzer_corpus/b3be1b28b64d4a3b2da9d7a2da48e4094e7102bf new file mode 100644 index 0000000000000..3edd5848c2915 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/b3be1b28b64d4a3b2da9d7a2da48e4094e7102bf @@ -0,0 +1,180 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "HasValueParam" + members { + function { + name: "Go" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + tuple_literal { + } + } + interface { + call { + function { + identifier { + name: "HasValueParam" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + fields { + int_literal { + value: 5 + } + } + } + } + } + } + members { + function { + name: "Go" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + int_literal { + value: 42 + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + compound_member_access { + object { + tuple_literal { + } + } + path { + simple_member_access { + field: "Go" + object { + call { + function { + identifier { + name: "HasValueParam" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + fields { + int_literal { + value: 5 + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/b671a41b29603d99d57b69e15c8ee86017b58555 b/explorer/fuzzing/fuzzer_corpus/b671a41b29603d99d57b69e15c8ee86017b58555 new file mode 100644 index 0000000000000..2b635c443b1aa --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/b671a41b29603d99d57b69e15c8ee86017b58555 @@ -0,0 +1,228 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "Point" + members { + function { + name: "Origin" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 0 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "GetX" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Origin" + object { + identifier { + name: "Point" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "f" + type { + expression_pattern { + expression { + function_type { + return_type { + int_type_literal { + } + } + parameter { + } + } + } + } + } + } + } + init { + simple_member_access { + field: "GetX" + object { + identifier { + name: "p" + } + } + } + } + } + } + statements { + return_statement { + expression { + call { + function { + identifier { + name: "f" + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/b717b68f111caf8b50c27f029988cd55d8d6eb83 b/explorer/fuzzing/fuzzer_corpus/b717b68f111caf8b50c27f029988cd55d8d6eb83 new file mode 100644 index 0000000000000..9c1a253a209b4 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/b717b68f111caf8b50c27f029988cd55d8d6eb83 @@ -0,0 +1,768 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "I" + members { + function { + name: "F" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "t" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "o" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "X" + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + call { + function { + identifier { + name: "I" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "U" + } + } + } + } + } + } + members { + function { + name: "F" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "u" + type { + expression_pattern { + expression { + identifier { + name: "U" + } + } + } + } + } + } + fields { + binding_pattern { + name: "o" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "m" + expression { + identifier { + name: "u" + } + } + } + fields { + name: "n" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "n" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "n" + object { + identifier { + name: "o" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "m" + type { + expression_pattern { + expression { + identifier { + name: "U" + } + } + } + } + } + } + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + type_params { + fields { + generic_binding { + name: "U" + type { + type_type_literal { + } + } + } + } + } + } + } + declarations { + function { + name: "Run" + deduced_parameters { + name: "V" + type { + type_type_literal { + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "V" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + tuple_literal { + fields { + identifier { + name: "V" + } + } + fields { + identifier { + name: "V" + } + } + fields { + int_type_literal { + } + } + fields { + int_type_literal { + } + } + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "X" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "V" + } + } + } + } + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "m" + expression { + identifier { + name: "x" + } + } + } + fields { + name: "n" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "w" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "X" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "V" + } + } + } + } + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "m" + expression { + identifier { + name: "x" + } + } + } + fields { + name: "n" + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "call" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "X" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "V" + } + } + } + } + } + } + } + } + } + } + init { + call { + function { + compound_member_access { + object { + identifier { + name: "v" + } + } + path { + compound_member_access { + object { + call { + function { + identifier { + name: "X" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "V" + } + } + } + } + } + } + path { + simple_member_access { + field: "F" + object { + call { + function { + identifier { + name: "I" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "V" + } + } + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "x" + } + } + fields { + identifier { + name: "w" + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + tuple_literal { + fields { + compound_member_access { + object { + identifier { + name: "call" + } + } + path { + simple_member_access { + field: "m" + object { + call { + function { + identifier { + name: "X" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "V" + } + } + } + } + } + } + } + } + } + } + fields { + simple_member_access { + field: "m" + object { + identifier { + name: "call" + } + } + } + } + fields { + compound_member_access { + object { + identifier { + name: "call" + } + } + path { + simple_member_access { + field: "n" + object { + call { + function { + identifier { + name: "X" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "V" + } + } + } + } + } + } + } + } + } + } + fields { + simple_member_access { + field: "n" + object { + identifier { + name: "call" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + tuple_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + fields { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + fields { + binding_pattern { + name: "d" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + init { + call { + function { + identifier { + name: "Run" + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Add + arguments { + operator { + op: Add + arguments { + operator { + op: Add + arguments { + operator { + op: Mul + arguments { + identifier { + name: "a" + } + } + arguments { + int_literal { + value: 1000 + } + } + } + } + arguments { + operator { + op: Mul + arguments { + identifier { + name: "b" + } + } + arguments { + int_literal { + value: 100 + } + } + } + } + } + } + arguments { + operator { + op: Mul + arguments { + identifier { + name: "c" + } + } + arguments { + int_literal { + value: 10 + } + } + } + } + } + } + arguments { + identifier { + name: "d" + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/b77f0f9be78ea2cf33d09e3ac7991e7560b8279f b/explorer/fuzzing/fuzzer_corpus/b77f0f9be78ea2cf33d09e3ac7991e7560b8279f new file mode 100644 index 0000000000000..7f3f6c6d02b4f --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/b77f0f9be78ea2cf33d09e3ac7991e7560b8279f @@ -0,0 +1,151 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "A" + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: InternalImpl + impl_type { + int_type_literal { + } + } + interface { + call { + function { + identifier { + name: "ImplicitAs" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "A" + } + } + } + } + } + } + members { + function { + name: "Convert" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "A" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "n" + expression { + identifier { + name: "me" + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + variable { + binding { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + initializer { + int_literal { + value: 5 + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + simple_member_access { + field: "n" + object { + identifier { + name: "a" + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/b77f65badb388ae3942c31237a85c8826c4e5648 b/explorer/fuzzing/fuzzer_corpus/b77f65badb388ae3942c31237a85c8826c4e5648 new file mode 100644 index 0000000000000..415db322df157 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/b77f65badb388ae3942c31237a85c8826c4e5648 @@ -0,0 +1,283 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "Point" + members { + function { + name: "Origin" + param_pattern { + fields { + binding_pattern { + name: "zero" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "Self" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + identifier { + name: "zero" + } + } + } + fields { + name: "y" + expression { + identifier { + name: "zero" + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "GetX" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Self" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_statement { + expression { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + type_params { + fields { + generic_binding { + name: "T" + type { + type_type_literal { + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Origin" + object { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "GetX" + object { + identifier { + name: "p" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/b9a64e39653c7cced9aad24e6e5d325ef5830379 b/explorer/fuzzing/fuzzer_corpus/b9a64e39653c7cced9aad24e6e5d325ef5830379 new file mode 100644 index 0000000000000..509a0089b0185 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/b9a64e39653c7cced9aad24e6e5d325ef5830379 @@ -0,0 +1,645 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Vector" + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + identifier { + name: "Vector" + } + } + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 0 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "AddAndScaleGeneric" + deduced_parameters { + name: "T" + type { + identifier { + name: "Vector" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "s" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "Scale" + object { + call { + function { + simple_member_access { + field: "Add" + object { + identifier { + name: "a" + } + } + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "T" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "s" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 2 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + identifier { + name: "AddAndScaleGeneric" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + int_literal { + value: 5 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "p" + } + } + } + } + arguments { + int_literal { + value: 10 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/ba1f80b94d3fbfede410d99944c2f916f18a66d9 b/explorer/fuzzing/fuzzer_corpus/ba1f80b94d3fbfede410d99944c2f916f18a66d9 new file mode 100644 index 0000000000000..754f3239c8529 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/ba1f80b94d3fbfede410d99944c2f916f18a66d9 @@ -0,0 +1,855 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Vector" + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "Point" + } + } + interface { + identifier { + name: "Vector" + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + identifier { + name: "Point" + } + } + interface { + identifier { + name: "Vector" + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "AddAndScaleGeneric" + deduced_parameters { + name: "T" + type { + identifier { + name: "Vector" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "s" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "Scale" + object { + call { + function { + simple_member_access { + field: "Add" + object { + identifier { + name: "a" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "b" + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "s" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 1 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 2 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 3 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + identifier { + name: "AddAndScaleGeneric" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + identifier { + name: "b" + } + } + fields { + int_literal { + value: 5 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "p" + } + } + } + } + arguments { + int_literal { + value: 15 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/c258828edd9181d61e184e6e73c9b34729ea69cc b/explorer/fuzzing/fuzzer_corpus/c258828edd9181d61e184e6e73c9b34729ea69cc new file mode 100644 index 0000000000000..228dfc44ab6ce --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/c258828edd9181d61e184e6e73c9b34729ea69cc @@ -0,0 +1,324 @@ +compilation_unit { + package_statement { + package_name: "Foo" + } + is_api: true + declarations { + class_declaration { + name: "X" + members { + function { + name: "F" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "o" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "n" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "n" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "n" + object { + identifier { + name: "o" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name: "Y" + members { + variable { + binding { + name: "m" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + call { + function { + identifier { + name: "ImplicitAs" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "X" + } + } + } + } + } + } + members { + function { + name: "Convert" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "X" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "n" + expression { + simple_member_access { + field: "m" + object { + identifier { + name: "me" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "y1" + type { + expression_pattern { + expression { + identifier { + name: "Y" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "m" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "y2" + type { + expression_pattern { + expression { + identifier { + name: "Y" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "m" + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + statements { + return_statement { + expression { + simple_member_access { + field: "n" + object { + call { + function { + compound_member_access { + object { + identifier { + name: "y1" + } + } + path { + simple_member_access { + field: "F" + object { + identifier { + name: "X" + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "y2" + } + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/cc4eceeba65c5547929371ff26806e82c5a776f3 b/explorer/fuzzing/fuzzer_corpus/cc4eceeba65c5547929371ff26806e82c5a776f3 new file mode 100644 index 0000000000000..994fbbefc1493 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/cc4eceeba65c5547929371ff26806e82c5a776f3 @@ -0,0 +1,712 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Vector" + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Point" + } + } + interface { + identifier { + name: "Vector" + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "ScaleGeneric" + deduced_parameters { + name: "U" + type { + identifier { + name: "Vector" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + identifier { + name: "U" + } + } + } + } + } + } + fields { + binding_pattern { + name: "s" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "U" + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "Scale" + object { + identifier { + name: "c" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "s" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "AddAndScaleGeneric" + deduced_parameters { + name: "T" + type { + identifier { + name: "Vector" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "s" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + identifier { + name: "ScaleGeneric" + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "Add" + object { + identifier { + name: "a" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "b" + } + } + } + } + } + } + fields { + identifier { + name: "s" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 1 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 2 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 3 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + identifier { + name: "AddAndScaleGeneric" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + identifier { + name: "b" + } + } + fields { + int_literal { + value: 5 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "p" + } + } + } + } + arguments { + int_literal { + value: 15 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/cd34239ea7c7fb125a300068dce22b77d9e1effa b/explorer/fuzzing/fuzzer_corpus/cd34239ea7c7fb125a300068dce22b77d9e1effa new file mode 100644 index 0000000000000..dabfefa360764 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/cd34239ea7c7fb125a300068dce22b77d9e1effa @@ -0,0 +1,495 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Number" + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + function { + name: "Origin" + param_pattern { + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "T" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + fields { + name: "y" + expression { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "T" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + type_params { + fields { + generic_binding { + name: "T" + type { + identifier { + name: "Number" + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + int_type_literal { + } + } + interface { + identifier { + name: "Number" + } + } + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + operator { + op: Add + arguments { + identifier { + name: "me" + } + } + arguments { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "SumXY" + deduced_parameters { + name: "U" + type { + identifier { + name: "Number" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "U" + } + } + } + } + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "U" + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "Add" + object { + simple_member_access { + field: "x" + object { + call { + function { + simple_member_access { + field: "Origin" + object { + identifier { + name: "p" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + simple_member_access { + field: "y" + object { + identifier { + name: "p" + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 0 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + statements { + return_statement { + expression { + call { + function { + identifier { + name: "SumXY" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "p" + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/d4060117085d164112756d399d7e3822e83f6c7a b/explorer/fuzzing/fuzzer_corpus/d4060117085d164112756d399d7e3822e83f6c7a new file mode 100644 index 0000000000000..ea7b6f0796a09 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/d4060117085d164112756d399d7e3822e83f6c7a @@ -0,0 +1,700 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Vector" + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Point" + } + } + interface { + identifier { + name: "Vector" + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "AddAndScaleGeneric" + deduced_parameters { + name: "T" + type { + identifier { + name: "Vector" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "s" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "m" + type { + expression_pattern { + expression { + function_type { + parameter { + fields { + identifier { + name: "T" + } + } + } + return_type { + identifier { + name: "T" + } + } + } + } + } + } + } + } + init { + simple_member_access { + field: "Add" + object { + identifier { + name: "a" + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "n" + type { + expression_pattern { + expression { + function_type { + parameter { + fields { + int_type_literal { + } + } + } + return_type { + identifier { + name: "T" + } + } + } + } + } + } + } + } + init { + simple_member_access { + field: "Scale" + object { + call { + function { + identifier { + name: "m" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + call { + function { + identifier { + name: "n" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "s" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 1 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 2 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 3 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + identifier { + name: "AddAndScaleGeneric" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + identifier { + name: "b" + } + } + fields { + int_literal { + value: 5 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "p" + } + } + } + } + arguments { + int_literal { + value: 15 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/d415017d19f5638734278f41adaa345e510f90d2 b/explorer/fuzzing/fuzzer_corpus/d415017d19f5638734278f41adaa345e510f90d2 new file mode 100644 index 0000000000000..7ffa4b4393267 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/d415017d19f5638734278f41adaa345e510f90d2 @@ -0,0 +1,124 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "A" + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + call { + function { + identifier { + name: "ImplicitAs" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + members { + function { + name: "Convert" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + int_literal { + value: 42 + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "A" + } + } + } + } + } + } + init { + struct_type_literal { + } + } + } + } + statements { + return_statement { + expression { + identifier { + name: "a" + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/d66f6dd50287a3f1d0d2ab22a9b7a6aee9d3a435 b/explorer/fuzzing/fuzzer_corpus/d66f6dd50287a3f1d0d2ab22a9b7a6aee9d3a435 new file mode 100644 index 0000000000000..f7a67051bfa90 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/d66f6dd50287a3f1d0d2ab22a9b7a6aee9d3a435 @@ -0,0 +1,266 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "LazyEq" + members { + variable { + binding { + name: "v1" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "v2" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + call { + function { + identifier { + name: "ImplicitAs" + } + } + argument { + tuple_literal { + fields { + bool_type_literal { + } + } + } + } + } + } + members { + function { + name: "Convert" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + bool_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + operator { + op: Eq + arguments { + simple_member_access { + field: "v1" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "v2" + object { + identifier { + name: "me" + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Make" + param_pattern { + fields { + binding_pattern { + name: "v1" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + fields { + binding_pattern { + name: "v2" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "v1" + expression { + identifier { + name: "v1" + } + } + } + fields { + name: "v2" + expression { + identifier { + name: "v2" + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + if_expression { + condition { + call { + function { + simple_member_access { + field: "Make" + object { + identifier { + name: "LazyEq" + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 2 + } + } + fields { + operator { + op: Add + arguments { + int_literal { + value: 1 + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + then_expression { + int_literal { + value: 1 + } + } + else_expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/d829468ac733b7dd5677070c722c3c7ecd34c496 b/explorer/fuzzing/fuzzer_corpus/d829468ac733b7dd5677070c722c3c7ecd34c496 new file mode 100644 index 0000000000000..76186b2cb5047 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/d829468ac733b7dd5677070c722c3c7ecd34c496 @@ -0,0 +1,183 @@ +compilation_unit { + package_statement { + package_name: "Foo" + } + is_api: true + declarations { + interface { + name: "A" + members { + function { + name: "F" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "X" + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + identifier { + name: "A" + } + } + members { + function { + name: "F" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "X" + } + } + } + } + } + } + init { + struct_type_literal { + } + } + } + } + statements { + return_statement { + expression { + call { + function { + compound_member_access { + object { + identifier { + name: "a" + } + } + path { + compound_member_access { + object { + identifier { + name: "X" + } + } + path { + simple_member_access { + field: "F" + object { + identifier { + name: "A" + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/dd3ba18239f1a0b8d128fb996df5957c04676354 b/explorer/fuzzing/fuzzer_corpus/dd3ba18239f1a0b8d128fb996df5957c04676354 new file mode 100644 index 0000000000000..6d9f92e209cdc --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/dd3ba18239f1a0b8d128fb996df5957c04676354 @@ -0,0 +1,565 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Number" + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + function { + name: "Origin" + param_pattern { + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "T" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + fields { + name: "y" + expression { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "T" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "SumXY" + param_pattern { + fields { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "Add" + object { + simple_member_access { + field: "x" + object { + identifier { + name: "p" + } + } + } + } + } + } + argument { + tuple_literal { + fields { + simple_member_access { + field: "y" + object { + identifier { + name: "p" + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "SumFn" + param_pattern { + } + return_term { + kind: Expression + type { + function_type { + parameter { + fields { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + return_type { + identifier { + name: "T" + } + } + } + } + } + body { + statements { + return_statement { + expression { + simple_member_access { + field: "SumXY" + object { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + type_params { + fields { + generic_binding { + name: "T" + type { + identifier { + name: "Number" + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + int_type_literal { + } + } + interface { + identifier { + name: "Number" + } + } + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + operator { + op: Add + arguments { + identifier { + name: "me" + } + } + arguments { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Origin" + object { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + return_statement { + expression { + call { + function { + call { + function { + simple_member_access { + field: "SumFn" + object { + identifier { + name: "p" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "p" + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/de61c912b8d3923ee9b6f46603394c1171c06f40 b/explorer/fuzzing/fuzzer_corpus/de61c912b8d3923ee9b6f46603394c1171c06f40 new file mode 100644 index 0000000000000..5b9e55de1fd56 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/de61c912b8d3923ee9b6f46603394c1171c06f40 @@ -0,0 +1,300 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "LazyNe" + members { + variable { + binding { + name: "v1" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "v2" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + call { + function { + identifier { + name: "ImplicitAs" + } + } + argument { + tuple_literal { + fields { + bool_type_literal { + } + } + } + } + } + } + members { + function { + name: "Convert" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + bool_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + operator { + op: Not + arguments { + operator { + op: Eq + arguments { + simple_member_access { + field: "v1" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "v2" + object { + identifier { + name: "me" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Make" + param_pattern { + fields { + binding_pattern { + name: "v1" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + fields { + binding_pattern { + name: "v2" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "v1" + expression { + identifier { + name: "v1" + } + } + } + fields { + name: "v2" + expression { + identifier { + name: "v2" + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "x" + type { + auto_pattern { + } + } + } + } + init { + int_literal { + value: 2 + } + } + } + } + statements { + while_statement { + condition { + call { + function { + simple_member_access { + field: "Make" + object { + identifier { + name: "LazyNe" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "x" + } + } + fields { + int_literal { + value: 0 + } + } + } + } + } + } + body { + statements { + assign { + lhs { + identifier { + name: "x" + } + } + rhs { + operator { + op: Sub + arguments { + identifier { + name: "x" + } + } + arguments { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + identifier { + name: "x" + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/df26c1e8e0e4003833b754f9265c211e25e3e9d6 b/explorer/fuzzing/fuzzer_corpus/df26c1e8e0e4003833b754f9265c211e25e3e9d6 new file mode 100644 index 0000000000000..2961cdb675d17 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/df26c1e8e0e4003833b754f9265c211e25e3e9d6 @@ -0,0 +1,976 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Number" + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + type_params { + fields { + generic_binding { + name: "T" + type { + identifier { + name: "Number" + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + int_type_literal { + } + } + interface { + identifier { + name: "Number" + } + } + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + operator { + op: Add + arguments { + identifier { + name: "me" + } + } + arguments { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + } + } + declarations { + impl { + kind: ExternalImpl + impl_type { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "U" + } + } + } + } + } + } + interface { + identifier { + name: "Number" + } + } + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "U" + } + } + } + } + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "U" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + fields { + name: "y" + expression { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "U" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "U" + } + } + } + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "other" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "U" + } + } + } + } + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "U" + } + } + } + } + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + call { + function { + simple_member_access { + field: "Add" + object { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + } + } + argument { + tuple_literal { + fields { + simple_member_access { + field: "x" + object { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + fields { + name: "y" + expression { + call { + function { + simple_member_access { + field: "Add" + object { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + } + } + argument { + tuple_literal { + fields { + simple_member_access { + field: "y" + object { + identifier { + name: "other" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Sum" + deduced_parameters { + name: "E" + type { + identifier { + name: "Number" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "E" + } + } + } + } + } + } + fields { + binding_pattern { + name: "y" + type { + expression_pattern { + expression { + identifier { + name: "E" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "E" + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "total" + type { + expression_pattern { + expression { + identifier { + name: "E" + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "E" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + statements { + assign { + lhs { + identifier { + name: "total" + } + } + rhs { + call { + function { + simple_member_access { + field: "Add" + object { + identifier { + name: "total" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "x" + } + } + } + } + } + } + } + } + statements { + assign { + lhs { + identifier { + name: "total" + } + } + rhs { + call { + function { + simple_member_access { + field: "Add" + object { + identifier { + name: "total" + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "y" + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + identifier { + name: "total" + } + } + } + } + } + } + } + declarations { + function { + name: "SumPoints" + deduced_parameters { + name: "E" + type { + identifier { + name: "Number" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "E" + } + } + } + } + } + } + } + } + } + } + fields { + binding_pattern { + name: "q" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "E" + } + } + } + } + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "E" + } + } + } + } + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + identifier { + name: "Sum" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "p" + } + } + fields { + identifier { + name: "q" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 1 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "q" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 4 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 3 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "r" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + call { + function { + identifier { + name: "SumPoints" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "p" + } + } + fields { + identifier { + name: "q" + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "r" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "r" + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/e5ba54dcd7ba2c5ce8ccc16ae9745c148644d837 b/explorer/fuzzing/fuzzer_corpus/e5ba54dcd7ba2c5ce8ccc16ae9745c148644d837 new file mode 100644 index 0000000000000..84ecd932d9d1b --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/e5ba54dcd7ba2c5ce8ccc16ae9745c148644d837 @@ -0,0 +1,374 @@ +compilation_unit { + package_statement { + package_name: "Foo" + } + is_api: true + declarations { + interface { + name: "A" + members { + function { + name: "F" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "o" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "X" + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + identifier { + name: "A" + } + } + members { + function { + name: "F" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "o" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "n" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "n" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "n" + object { + identifier { + name: "o" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "F" + deduced_parameters { + name: "T" + type { + identifier { + name: "A" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "w" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + compound_member_access { + object { + identifier { + name: "v" + } + } + path { + simple_member_access { + field: "F" + object { + identifier { + name: "T" + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "w" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + identifier { + name: "X" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "w" + type { + expression_pattern { + expression { + identifier { + name: "X" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + statements { + return_statement { + expression { + simple_member_access { + field: "n" + object { + call { + function { + identifier { + name: "F" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "v" + } + } + fields { + identifier { + name: "w" + } + } + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/e629764c8d1fa144b53709998d97097c64b8777e b/explorer/fuzzing/fuzzer_corpus/e629764c8d1fa144b53709998d97097c64b8777e new file mode 100644 index 0000000000000..447e45df02731 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/e629764c8d1fa144b53709998d97097c64b8777e @@ -0,0 +1,465 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "One" + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "One" + } + } + interface { + call { + function { + identifier { + name: "ImplicitAs" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + members { + function { + name: "Convert" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name: "Two" + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Two" + } + } + interface { + call { + function { + identifier { + name: "ImplicitAs" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + members { + function { + name: "Convert" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + int_literal { + value: 2 + } + } + } + } + } + } + } + } + } + } + } + declarations { + class_declaration { + name: "N" + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "N" + } + } + interface { + call { + function { + identifier { + name: "ImplicitAs" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + members { + function { + name: "Convert" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + simple_member_access { + field: "n" + object { + identifier { + name: "me" + } + } + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "n" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Get" + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + fields { + binding_pattern { + name: "c" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + return_statement { + expression { + operator { + op: Add + arguments { + operator { + op: Add + arguments { + operator { + op: Mul + arguments { + int_literal { + value: 100 + } + } + arguments { + identifier { + name: "a" + } + } + } + } + arguments { + operator { + op: Mul + arguments { + int_literal { + value: 10 + } + } + arguments { + identifier { + name: "b" + } + } + } + } + } + } + arguments { + identifier { + name: "c" + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "i" + type { + expression_pattern { + expression { + identifier { + name: "One" + } + } + } + } + } + } + init { + struct_type_literal { + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "ii" + type { + expression_pattern { + expression { + identifier { + name: "Two" + } + } + } + } + } + } + init { + struct_type_literal { + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "iii" + type { + expression_pattern { + expression { + identifier { + name: "N" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "n" + expression { + int_literal { + value: 3 + } + } + } + } + } + } + } + statements { + return_statement { + expression { + call { + function { + identifier { + name: "Get" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "i" + } + } + fields { + identifier { + name: "ii" + } + } + fields { + identifier { + name: "iii" + } + } + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/ec71d604f3ad77986eef7d9e78385bb475528dff b/explorer/fuzzing/fuzzer_corpus/ec71d604f3ad77986eef7d9e78385bb475528dff new file mode 100644 index 0000000000000..4699008c0728e --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/ec71d604f3ad77986eef7d9e78385bb475528dff @@ -0,0 +1,679 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Vector" + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + identifier { + name: "Scalar" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Point" + } + } + interface { + call { + function { + identifier { + name: "Vector" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 0 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "AddAndScaleGeneric" + deduced_parameters { + name: "T" + type { + type_type_literal { + } + } + } + deduced_parameters { + name: "U" + type { + call { + function { + identifier { + name: "Vector" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "U" + } + } + } + } + } + } + fields { + binding_pattern { + name: "s" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "U" + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "Scale" + object { + call { + function { + simple_member_access { + field: "Add" + object { + identifier { + name: "a" + } + } + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "U" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "s" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 2 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + identifier { + name: "AddAndScaleGeneric" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + int_literal { + value: 5 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "p" + } + } + } + } + arguments { + int_literal { + value: 10 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/f6c7f3c7192ebe59a4329e3a991597d864cb43d9 b/explorer/fuzzing/fuzzer_corpus/f6c7f3c7192ebe59a4329e3a991597d864cb43d9 new file mode 100644 index 0000000000000..203bf9c6c7999 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/f6c7f3c7192ebe59a4329e3a991597d864cb43d9 @@ -0,0 +1,645 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Vector" + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Self" + } + } + interface { + identifier { + name: "Vector" + } + } + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 0 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "AddAndScaleGeneric" + deduced_parameters { + name: "T" + type { + identifier { + name: "Vector" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "s" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "Scale" + object { + call { + function { + simple_member_access { + field: "Add" + object { + identifier { + name: "a" + } + } + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "T" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "s" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 2 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + identifier { + name: "AddAndScaleGeneric" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + int_literal { + value: 5 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "p" + } + } + } + } + arguments { + int_literal { + value: 10 + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/fc5f5e4f348579cedbecae8dccafc9f9dae68237 b/explorer/fuzzing/fuzzer_corpus/fc5f5e4f348579cedbecae8dccafc9f9dae68237 new file mode 100644 index 0000000000000..7b789e3a426a1 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/fc5f5e4f348579cedbecae8dccafc9f9dae68237 @@ -0,0 +1,283 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + class_declaration { + name: "Point" + members { + function { + name: "Origin" + param_pattern { + fields { + binding_pattern { + name: "zero" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + identifier { + name: "zero" + } + } + } + fields { + name: "y" + expression { + identifier { + name: "zero" + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "GetX" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "T" + } + } + } + } + } + } + } + } + } + } + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_statement { + expression { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + } + } + } + } + } + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + } + type_params { + fields { + generic_binding { + name: "T" + type { + type_type_literal { + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + } + } + init { + call { + function { + simple_member_access { + field: "Origin" + object { + call { + function { + identifier { + name: "Point" + } + } + argument { + tuple_literal { + fields { + int_type_literal { + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "GetX" + object { + identifier { + name: "p" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } +} diff --git a/explorer/fuzzing/fuzzer_corpus/fde210ff5a67c2b595b17353fb8ef9ff9275c4db b/explorer/fuzzing/fuzzer_corpus/fde210ff5a67c2b595b17353fb8ef9ff9275c4db new file mode 100644 index 0000000000000..70f546f296b50 --- /dev/null +++ b/explorer/fuzzing/fuzzer_corpus/fde210ff5a67c2b595b17353fb8ef9ff9275c4db @@ -0,0 +1,645 @@ +compilation_unit { + package_statement { + package_name: "ExplorerTest" + } + is_api: true + declarations { + interface { + name: "Vector" + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Self" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Self" + } + } + } + } + } + self { + name: "Self" + type { + type_type_literal { + } + } + } + } + } + declarations { + class_declaration { + name: "Point" + members { + variable { + binding { + name: "x" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + variable { + binding { + name: "y" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + members { + impl { + kind: InternalImpl + impl_type { + identifier { + name: "Point" + } + } + interface { + identifier { + name: "Vector" + } + } + members { + function { + name: "Zero" + param_pattern { + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 0 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 0 + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Add" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "b" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Add + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "b" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + members { + function { + name: "Scale" + me_pattern { + binding_pattern { + name: "me" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + param_pattern { + fields { + binding_pattern { + name: "v" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "Point" + } + } + } + body { + statements { + return_statement { + expression { + struct_literal { + fields { + name: "x" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + fields { + name: "y" + expression { + operator { + op: Mul + arguments { + simple_member_access { + field: "y" + object { + identifier { + name: "me" + } + } + } + } + arguments { + identifier { + name: "v" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "AddAndScaleGeneric" + deduced_parameters { + name: "T" + type { + identifier { + name: "Vector" + } + } + } + param_pattern { + fields { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "T" + } + } + } + } + } + } + fields { + binding_pattern { + name: "s" + type { + expression_pattern { + expression { + int_type_literal { + } + } + } + } + } + } + } + return_term { + kind: Expression + type { + identifier { + name: "T" + } + } + } + body { + statements { + return_statement { + expression { + call { + function { + simple_member_access { + field: "Scale" + object { + call { + function { + simple_member_access { + field: "Add" + object { + identifier { + name: "a" + } + } + } + } + argument { + tuple_literal { + fields { + call { + function { + simple_member_access { + field: "Zero" + object { + identifier { + name: "T" + } + } + } + } + argument { + tuple_literal { + } + } + } + } + } + } + } + } + } + } + argument { + tuple_literal { + fields { + identifier { + name: "s" + } + } + } + } + } + } + } + } + } + } + } + declarations { + function { + name: "Main" + param_pattern { + } + return_term { + kind: Expression + type { + int_type_literal { + } + } + } + body { + statements { + variable_definition { + pattern { + binding_pattern { + name: "a" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + struct_literal { + fields { + name: "x" + expression { + int_literal { + value: 2 + } + } + } + fields { + name: "y" + expression { + int_literal { + value: 1 + } + } + } + } + } + } + } + statements { + variable_definition { + pattern { + binding_pattern { + name: "p" + type { + expression_pattern { + expression { + identifier { + name: "Point" + } + } + } + } + } + } + init { + call { + function { + identifier { + name: "AddAndScaleGeneric" + } + } + argument { + tuple_literal { + fields { + identifier { + name: "a" + } + } + fields { + int_literal { + value: 5 + } + } + } + } + } + } + } + } + statements { + return_statement { + expression { + operator { + op: Sub + arguments { + simple_member_access { + field: "x" + object { + identifier { + name: "p" + } + } + } + } + arguments { + int_literal { + value: 10 + } + } + } + } + } + } + } + } + } +} From 13d3aefa0dd4752758623a4b82760c09529c9550 Mon Sep 17 00:00:00 2001 From: Josh L Date: Sat, 23 Jul 2022 21:38:23 +0000 Subject: [PATCH 17/20] Restore fail-method-me-type.carbon --- .../testdata/addr/fail-method-me-type.carbon | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 explorer/testdata/addr/fail-method-me-type.carbon diff --git a/explorer/testdata/addr/fail-method-me-type.carbon b/explorer/testdata/addr/fail-method-me-type.carbon new file mode 100644 index 0000000000000..3babe10f6a838 --- /dev/null +++ b/explorer/testdata/addr/fail-method-me-type.carbon @@ -0,0 +1,41 @@ +// 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: %{not} %{explorer} %s 2>&1 | \ +// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s +// RUN: %{not} %{explorer} --parser_debug --trace_file=- %s 2>&1 | \ +// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s +// AUTOUPDATE: %{explorer} %s + +package ExplorerTest api; + +class Shape { + var x: i32; +} + +class Point { + + fn Origin() -> Point { + return {.x = 0, .y = 0}; + } + + fn GetSetX[addr me: Shape*](x: i32) -> i32 { + var old: auto = (*me).x; + (*me).x = x; + return old; + } + + var x: i32; + var y: i32; +} + +fn Main() -> i32 { + var p: Point = Point.Origin(); + // CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/addr/fail-method-me-type.carbon:[[@LINE+1]]: type error in method access, receiver type: 'class Point' is not implicitly convertible to 'class Shape' + var x: auto = p.GetSetX(42); + if (p.x == 42) { + return x; + } + return 1; +} From 57cd781a9aa8f081318c4528255779f4c543275c Mon Sep 17 00:00:00 2001 From: Josh L Date: Thu, 25 Aug 2022 23:46:00 +0000 Subject: [PATCH 18/20] Include C++23 explicit this --- proposals/p1382.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/proposals/p1382.md b/proposals/p1382.md index 477b8c68a2544..0497dc6445154 100644 --- a/proposals/p1382.md +++ b/proposals/p1382.md @@ -56,7 +56,11 @@ Looking at other languages that use reserved word for the receiver value: In detail: - C++ uses - [`this` for address of the receiver value](https://en.cppreference.com/w/cpp/language/this) + [`this` for address of the receiver value](https://en.cppreference.com/w/cpp/language/this). + C++23 includes + [an explicit `this` facility](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0847r7.html). + Examples in the proposal frequently use `self` as the name of the parameter, + and `Self` as its type. - Swift uses [`self` for the receiver value](https://docs.swift.org/swift-book/LanguageGuide/Methods.html#ID238). and @@ -66,7 +70,7 @@ In detail: and [`Self` for its type](https://doc.rust-lang.org/rust-by-example/fn/methods.html). - C# uses - [`this` for a reference to the receiver value](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/this) + [`this` for a reference to the receiver value](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/this). - Python as a convention uses `self` for the receiver value, but it's almost universally followed. - Go conventionally uses an abbreviation of the type name. From fda1ceb11525c2c4ff0e1d3ce1c0e7d7e610b316 Mon Sep 17 00:00:00 2001 From: Josh L Date: Tue, 6 Dec 2022 21:58:30 +0000 Subject: [PATCH 19/20] Expand rationale to not use `this`. Co-authored-by: Richard Smith --- proposals/p1382.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/proposals/p1382.md b/proposals/p1382.md index 0497dc6445154..a309952a1f3b8 100644 --- a/proposals/p1382.md +++ b/proposals/p1382.md @@ -107,6 +107,15 @@ than `self`. There are two considerations: ### `this` We could also switch to `this`, primarily to benefit -[C++ users](https://en.cppreference.com/w/cpp/language/this). However, we are -worried that it frequently not being a pointer would be surprising to those C++ -users. +[C++ users](https://en.cppreference.com/w/cpp/language/this). This had a few +disadvantages: + +- We are worried that it frequently not being a pointer would be surprising to + those C++ users. +- As noted in [the background section](#background), C++23 code using explicit + this frequently uses the name `self`. +- We view it as an advantage to use the same spelling for the variable `self` + as for the type `Self`, and while `this` might make an acceptable name for + the object parameter, `Self` is much more strongly established as the name + for the current class, for example in PL research, and there is no precedent + for a type named `This`. From 2b7ee5ad82e7d9ca9052110939c6be64367c451d Mon Sep 17 00:00:00 2001 From: Josh L Date: Tue, 6 Dec 2022 23:41:03 +0000 Subject: [PATCH 20/20] Add reference to `self` history from @micttyl --- proposals/p1382.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/proposals/p1382.md b/proposals/p1382.md index a309952a1f3b8..2971912b92061 100644 --- a/proposals/p1382.md +++ b/proposals/p1382.md @@ -75,6 +75,11 @@ In detail: universally followed. - Go conventionally uses an abbreviation of the type name. +Some history about the use of `self` in programming languages is documented in +[this StackOverflow answer](https://stackoverflow.com/a/1080192/624900), +including that `self` is also used in Smalltalk, Modula-3, Delphi/Object Pascal, +and Objective-C. + ## Proposal Use `self` instead of `me` to be consistent with Swift and Rust.