7cce1bd124
interfaces, impls, and constrained generics (basics) ( #1073 )
...
* interfaces, impls, and constrained generics (basics)
* separate type checking into declare vs. type check, removing redundancy
* external impls
* added impl scopes to handle generics calling generics
* cleanup
* more cleanup
* Update executable_semantics/testdata/interface/external_impl_point_vector.carbon
Co-authored-by: josh11b <josh11b@users.noreply.github.com >
* Update executable_semantics/testdata/interface/generic_call_generic.carbon
Co-authored-by: josh11b <josh11b@users.noreply.github.com >
* Update executable_semantics/testdata/interface/tuple_vector_add_scale.carbon
Co-authored-by: josh11b <josh11b@users.noreply.github.com >
* Update executable_semantics/testdata/interface/vector_point_add_scale.carbon
Co-authored-by: josh11b <josh11b@users.noreply.github.com >
* change ImplementationDeclaration to ImplDeclaration
* remove impl_type_value
* split NamedEntity into two
* changed GetName to be a free function
* adding comments
* more edits to respond to review
* introduce ImplBinding, remove punning on GenericBinding
* new test case and some minor edits
* refactor GetMember and GetField to move impl logic to interpreter
* remove commennt
* change EntityView to ImplBinding in FieldAccess...
* move ImplBinding
* review response
* added example to impl_scope.h
* minor edits
* Update executable_semantics/interpreter/field_path.h
Co-authored-by: Geoff Romer <gromer@google.com >
* Update executable_semantics/interpreter/value.cpp
Co-authored-by: Geoff Romer <gromer@google.com >
* Update executable_semantics/interpreter/interpreter.cpp
Co-authored-by: Geoff Romer <gromer@google.com >
* Update executable_semantics/ast/expression.h
Co-authored-by: Geoff Romer <gromer@google.com >
* Update executable_semantics/ast/expression.h
Co-authored-by: Geoff Romer <gromer@google.com >
* Update executable_semantics/ast/generic_binding.h
Co-authored-by: Geoff Romer <gromer@google.com >
* more edits from review
* review response
* Update executable_semantics/ast/static_scope.h
Co-authored-by: Geoff Romer <gromer@google.com >
* remove ImplType, renamed node_view to value_node
Co-authored-by: josh11b <josh11b@users.noreply.github.com >
Co-authored-by: Geoff Romer <gromer@google.com >
2022-03-02 15:58:45 -05:00
Jon Meow
beea60d0b8
Switch prelude to a file and refactor lit testing to pass commands directly. ( #966 )
2021-12-03 14:23:13 -08:00
Jon Meow
6d822ababb
Rename main to Main for Carbon style consistency ( #939 )
...
Main() is more consistency with Carbon's naming guidelines. C# offers some precedent: https://docs.microsoft.com/en-us/dotnet/csharp/fundamentals/program-structure/main-command-line
2021-11-02 14:53:18 -07:00
Geoff Romer and Jon Meow
bc5a42211b
Support struct implicit conversions in type-checking ( #870 )
...
I should emphasize that I am **completely cheating** here. This PR does not add support for actually _performing_ implicit conversions at run time, because the AST doesn't yet contain the necessary type information. At run time, code like `var p: Point = {.x = 1, .y = 2};` directly initializes the name `p` with the _struct_ value `{.x = 1, .y = 2}`; no object of type `Point` is actually created. I'm only getting away with this because we don't yet have any tests that can tell the difference.
Co-authored-by: Jon Meow <46229924+jonmeow@users.noreply.github.com >
2021-10-12 10:27:20 -07:00
Geoff Romer
d5eb9a72f9
Fix shadowing.carbon to test shadowing behavior. ( #872 )
2021-10-05 16:08:15 -07:00
Jon Meow
395a331cde
Reorganize tests into dirs and rename numbered tests ( #825 )
...
There's a small update to update_checks.py to handle the recursive directories. Also, I'm only using one level of nesting in this PR but really no reason we can't do more. I'm just not sure what clustering is best right now.
As a pattern, I'm trying to name all failing tests `fail_*.carbon`.
2021-09-15 16:37:34 -07:00