From c8947e760eab82ae258de7814d0fb32a2a107384 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Tue, 14 Jan 2020 17:27:39 -0800 Subject: [PATCH] go/types: update README Change-Id: I73eec3fa1ce247ae91e6acacfdd238a8314a3969 --- src/go/types/NOTES | 1 + src/go/types/README | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/go/types/NOTES b/src/go/types/NOTES index e1478194e3..33bcbec8cd 100644 --- a/src/go/types/NOTES +++ b/src/go/types/NOTES @@ -14,6 +14,7 @@ TODO ---------------------------------------------------------------------------------------------------- KNOWN ISSUES +- cannot handle mutually recursive parameterized interfaces using themselves as type bounds - contract instantiation requires the type arguments to be type parameters from the type of function type parameter list or enclosing contract - instantiating a parameterized function type w/o value or result parameters may have unexpected side-effects diff --git a/src/go/types/README b/src/go/types/README index c09bb8a3cf..5b0f176363 100644 --- a/src/go/types/README +++ b/src/go/types/README @@ -12,8 +12,8 @@ Read and use this code at your own risk. STATUS -Most aspects of the contracts proposal have been implemented and somewhat -tested (but expect bugs). go/types can now type-check all the *.go2 test +Most aspects of the contracts proposal have been implemented and tested +(but expect bugs). go/types can now type-check all the *.go2 test files in the testdata and examples directories. ALTERNATIVE NOTATION @@ -71,13 +71,17 @@ and interfaces and the question if they can be mixed and how. Interfaces are the fundamental underlying typing mechanism; contracts are syntactic sugar that may improve readability. +To explore the boundaries of this new approach, this prototype +permits type parameters also on methods (we don't have a good +idea how to implement that but we can easily type-check it). + MAJOR KNOWN ISSUES - importing of packages exporting generic code is not implemented (and won't be implemented in this prototype) -- various type-specific operations (such as indexing, sending a - message, type assertions, etc.) on expressions of a generic type - don't work yet (but are relatively easy to implement going forward) +- various type-specific operations (such as sending a message, type + assertions, etc.) on expressions of a generic type don't work yet + (but are relatively easy to implement going forward) - error messages are reasonable but expect them to be significantly better in a real implementation (the subscript numbers on type parameters are there to visually identify different parameters @@ -90,7 +94,7 @@ current state and issues. TO PLAY WITH THIS PROTOTYPE - Cherry-pick this CL on top of tip (the cherry-pick was tested with - tip at bf26847240): + tip at cae9a9fd65): git fetch "https://go.googlesource.com/go" ... && git cherry-pick FETCH_HEAD @@ -133,6 +137,6 @@ Updates: 12/15/2019: Significant progress with much of the functionality present. 12/19/2019: Several bugs around type bounds checking fixed; more complex examples. 12/20/2019: Treat contracts as objects, not types anymore. Various bug fixes and more examples. -1/2/2020: Implemented contract embedding. Various bug fixes. +1/14/2020: Implemented contract embedding and instantiation. Lots of bug fixes. Change-Id: I29839b5e95d7050fce1dcb3334d3d324883cf76f