Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 12 for mustTypecheck (0.26 sec)

  1. src/go/types/instantiate_test.go

    			}
    		})
    	}
    }
    
    func TestInstantiateNonEquality(t *testing.T) {
    	const src = "package p; type T[P any] int"
    	pkg1 := mustTypecheck(src, nil, nil)
    	pkg2 := mustTypecheck(src, nil, nil)
    	// We consider T1 and T2 to be distinct types, so their instances should not
    	// be deduplicated by the context.
    	T1 := pkg1.Scope().Lookup("T").Type().(*Named)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 03 18:48:38 UTC 2024
    - 5.9K bytes
    - Viewed (0)
  2. src/cmd/compile/internal/types2/issues_test.go

    	const bsrc = `package b; import "a"; type T struct { F interface { a.I } }; var _ = a.T(T{})`
    
    	a := mustTypecheck(asrc, nil, nil)
    
    	conf := Config{Importer: importHelper{pkg: a}}
    	mustTypecheck(bsrc, &conf, nil)
    }
    
    type importHelper struct {
    	pkg      *Package
    	fallback Importer
    }
    
    func (h importHelper) Import(path string) (*Package, error) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 28.1K bytes
    - Viewed (0)
  3. src/cmd/compile/internal/types2/named_test.go

    	P int
    }
    
    func (T) M(int) {}
    func (T) N() (i int) { return }
    
    type G[P any] struct {
    	F P
    }
    
    func (G[P]) M(P) {}
    func (G[P]) N() (p P) { return }
    
    type Inst = G[int]
    	`
    	pkg := mustTypecheck(src, nil, nil)
    
    	var (
    		T        = pkg.Scope().Lookup("T").Type()
    		G        = pkg.Scope().Lookup("G").Type()
    		SrcInst  = pkg.Scope().Lookup("Inst").Type()
    		UserInst = mustInstantiate(b, G, Typ[Int])
    	)
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 16 21:06:56 UTC 2024
    - 3.6K bytes
    - Viewed (0)
  4. src/go/types/issues_test.go

    	const bsrc = `package b; import "a"; type T struct { F interface { a.I } }; var _ = a.T(T{})`
    
    	a := mustTypecheck(asrc, nil, nil)
    
    	conf := Config{Importer: importHelper{pkg: a}}
    	mustTypecheck(bsrc, &conf, nil)
    }
    
    type importHelper struct {
    	pkg      *Package
    	fallback Importer
    }
    
    func (h importHelper) Import(path string) (*Package, error) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 28.1K bytes
    - Viewed (0)
  5. src/go/types/named_test.go

    	P int
    }
    
    func (T) M(int) {}
    func (T) N() (i int) { return }
    
    type G[P any] struct {
    	F P
    }
    
    func (G[P]) M(P) {}
    func (G[P]) N() (p P) { return }
    
    type Inst = G[int]
    	`
    	pkg := mustTypecheck(src, nil, nil)
    
    	var (
    		T        = pkg.Scope().Lookup("T").Type()
    		G        = pkg.Scope().Lookup("G").Type()
    		SrcInst  = pkg.Scope().Lookup("Inst").Type()
    		UserInst = mustInstantiate(b, G, Typ[Int])
    	)
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 05 16:29:58 UTC 2024
    - 3.9K bytes
    - Viewed (0)
  6. src/go/types/api_test.go

    	if conf == nil {
    		conf = &Config{
    			Error:    func(err error) {}, // collect all errors
    			Importer: importer.Default(),
    		}
    	}
    	return conf.Check(f.Name.Name, fset, []*ast.File{f}, info)
    }
    
    func mustTypecheck(src string, conf *Config, info *Info) *Package {
    	pkg, err := typecheck(src, conf, info)
    	if err != nil {
    		panic(err) // so we don't need to pass *testing.T
    	}
    	return pkg
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 94.2K bytes
    - Viewed (0)
  7. src/cmd/compile/internal/types2/api_test.go

    	if conf == nil {
    		conf = &Config{
    			Error:    func(err error) {}, // collect all errors
    			Importer: defaultImporter(),
    		}
    	}
    	return conf.Check(f.PkgName.Value, []*syntax.File{f}, info)
    }
    
    func mustTypecheck(src string, conf *Config, info *Info) *Package {
    	pkg, err := typecheck(src, conf, info)
    	if err != nil {
    		panic(err) // so we don't need to pass *testing.T
    	}
    	return pkg
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 07 20:08:23 UTC 2024
    - 93.3K bytes
    - Viewed (0)
  8. src/go/types/hilbert_test.go

    	// generate source
    	src := program(*H, *out)
    	if *out != "" {
    		os.WriteFile(*out, src, 0666)
    		return
    	}
    
    	DefPredeclaredTestFuncs() // declare assert (used by code generated by verify)
    	mustTypecheck(string(src), nil, nil)
    }
    
    func program(n int, out string) []byte {
    	var g gen
    
    	g.p(`// Code generated by: go test -run=Hilbert -H=%d -out=%q. DO NOT EDIT.
    
    // +`+`build ignore
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 03 18:48:38 UTC 2024
    - 3.5K bytes
    - Viewed (0)
  9. src/go/types/object_test.go

    // the same Func Object as the original method. See also go.dev/issue/34421.
    func TestEmbeddedMethod(t *testing.T) {
    	const src = `package p; type I interface { error }`
    	pkg := mustTypecheck(src, nil, nil)
    
    	// get original error.Error method
    	eface := Universe.Lookup("error")
    	orig, _, _ := LookupFieldOrMethod(eface.Type(), false, nil, "Error")
    	if orig == nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 18 14:10:44 UTC 2024
    - 5.2K bytes
    - Viewed (0)
  10. src/cmd/compile/internal/types2/object_test.go

    // the same Func Object as the original method. See also go.dev/issue/34421.
    func TestEmbeddedMethod(t *testing.T) {
    	const src = `package p; type I interface { error }`
    	pkg := mustTypecheck(src, nil, nil)
    
    	// get original error.Error method
    	eface := Universe.Lookup("error")
    	orig, _, _ := LookupFieldOrMethod(eface.Type(), false, nil, "Error")
    	if orig == nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 18 14:10:44 UTC 2024
    - 5.2K bytes
    - Viewed (0)
Back to top