Skip to content

expected type 'type', found 'fn(comptime type) type' complains about wrong line #14768

Description

@codethief

Zig Version

0.11.0-dev.1836+28364166e

Steps to Reproduce and Observed Output

Hi there, I have a function

pub fn foo(param1: anytype, param2: bool) bool {
    var buffer: [200]u8 = undefined;
    const stream: std.io.FixedBufferStream = std.io.fixedBufferStream(&buffer);
    const writer = stream.writer();
    // ...
    return true;
}

and am getting the following error:

src/string_ops.zig:94:1: error: expected type 'type', found 'fn(comptime type) type'
pub fn foo(param1: anytype, param2: bool) bool {
^~~

I realize this is due std.io.FixedBufferStream, which is not a type but a function. However, the error message complains about foo().

Expected Output

src/string_ops.zig:xx:x: error: expected type 'type', found 'fn(comptime type) type'
    const stream: std.io.FixedBufferStream = std.io.fixedBufferStream(&buffer);
                  ^~~

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions