From e4a39e916f518e6d34d0bdd18cea8ac15cae7d2d Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Tue, 8 Oct 2019 18:17:53 -0700 Subject: [PATCH] go/types: update README Change-Id: I81e8304da885f36a2f6a41f6809063e74e87b0ea --- src/go/types/README | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/go/types/README b/src/go/types/README index d5ee31c625..6433e65a47 100644 --- a/src/go/types/README +++ b/src/go/types/README @@ -6,7 +6,7 @@ CAUTION: EARLY PROTOTYPE. MISSING PIECES. THERE ARE BUGS. Read and use the code at your own risk. -That said, the go/parser and go/ast changes are working and pass tests +The go/parser and go/ast changes are working and pass tests including all the larger examples in the latest contracts design doc. Look for the *.go2 files in go/parser/testdata. @@ -19,8 +19,8 @@ Specifically, the following pieces (and more) are missing from type- checking or lead to unexpected behavior: - Importing of packages with type parameters or contracts. -- Type-checking of contracts is limited to contracts with methods. -- Methods with parameterized receiver types are not implemented yet. +- Type-checking of contracts with type constraints shows initial + signs of life but is still work in progress. The following is "working" (as in: can be type-checked without errors): @@ -28,6 +28,8 @@ The following is "working" (as in: can be type-checked without errors): - Declaration and use (calls) of parameterized functions, including type inference from function arguments. - Some larger tests pass mostly (see testdata/*.go2 files). +- First contracts with type constraints and simple operators + (see end of testdata/contracts.go2 file for examples). Some code may look like it's working, but it may simply not do anything. @@ -37,7 +39,7 @@ them to be significantly better in a more complete implementation. To play with this prototype: - Cherry-pick this CL on top of tip (the cherry-pick was tested with - tip at 4983a0b75b40): + tip at 5650a53dac737): git fetch "https://go.googlesource.com/go" ... && git cherry-pick FETCH_HEAD @@ -56,4 +58,8 @@ See also `gotype -h` for more information. Note: Currently, files containing parameterized code have extension ".go2". This is solely to distinguish them from regular Go code and to prevent gofmt -from touching them. We expect a proper implementation to keep using ".go". \ No newline at end of file +from touching them. We expect a proper implementation to keep using ".go". + +Update 8/04/2019: Several bugs around type inference and type instantiation fixed. +Update 8/16/2019: Many issues around type instantiations and contracts with methods fixed. +Update 10/8/2019: Contracts with type constraints starting to be usable.