Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for assertableTo (0.11 sec)

  1. src/cmd/compile/internal/types2/api_test.go

    		V := test.T
    		T := test.V
    		want := false
    		if _, ok := T.Underlying().(*Interface); (ok || Implements(T, V)) && T != Bad {
    			want = true
    		}
    		if got := AssertableTo(V, T); got != want {
    			t.Errorf("AssertableTo(%s, %s) = %t, want %t", V, T, got, want)
    		}
    	}
    }
    
    func TestMissingMethodAlternative(t *testing.T) {
    	const src = `
    package p
    type T interface {
    	m()
    }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 07 20:08:23 UTC 2024
    - 93.3K bytes
    - Viewed (0)
  2. src/go/types/api_test.go

    		V := test.T
    		T := test.V
    		want := false
    		if _, ok := T.Underlying().(*Interface); (ok || Implements(T, V)) && T != Bad {
    			want = true
    		}
    		if got := AssertableTo(V, T); got != want {
    			t.Errorf("AssertableTo(%s, %s) = %t, want %t", V, T, got, want)
    		}
    	}
    }
    
    func TestMissingMethodAlternative(t *testing.T) {
    	const src = `
    package p
    type T interface {
    	m()
    }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 94.2K bytes
    - Viewed (0)
  3. src/go/types/expr.go

    	}
    	return x
    }
    
    // typeAssertion checks x.(T). The type of x must be an interface.
    func (check *Checker) typeAssertion(e ast.Expr, x *operand, T Type, typeSwitch bool) {
    	var cause string
    	if check.assertableTo(x.typ, T, &cause) {
    		return // success
    	}
    
    	if typeSwitch {
    		check.errorf(e, ImpossibleAssert, "impossible type switch case: %s\n\t%s cannot have dynamic type %s %s", e, x, T, cause)
    		return
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 02:09:54 UTC 2024
    - 49.7K bytes
    - Viewed (0)
  4. src/cmd/compile/internal/types2/expr.go

    	}
    	return x
    }
    
    // typeAssertion checks x.(T). The type of x must be an interface.
    func (check *Checker) typeAssertion(e syntax.Expr, x *operand, T Type, typeSwitch bool) {
    	var cause string
    	if check.assertableTo(x.typ, T, &cause) {
    		return // success
    	}
    
    	if typeSwitch {
    		check.errorf(e, ImpossibleAssert, "impossible type switch case: %s\n\t%s cannot have dynamic type %s %s", e, x, T, cause)
    		return
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 02:09:54 UTC 2024
    - 51.7K bytes
    - Viewed (0)
Back to top