Skip to content

Missing type cast for narrowed generic method return type #828

Closed
@danieldickison

Description

@danieldickison

As of 1.3 there's a missing type cast when calling a subclass/interface method where the return type has been narrowed by the subclass, and narrowed even further by the current method context. For example:

interface Foo<A> { A foo(); }
interface Bar<B extends Number> extends Foo<B> { }
Integer test(Bar<Integer> bar) { return bar.foo(); } }

Produces:

return [((id<Test_Bar>) nil_chk(bar)) call];

The method body for test should cast the return type to JavaLangInteger. The type cast exists in 1.2 but not in 1.3, causing a warning from the objc compiler.

Here is a test case: bandcampdotcom@874144e

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions