vls icon indicating copy to clipboard operation
vls copied to clipboard

Failed to compile: io.Eof doesn't exist

Open MKuranowski opened this issue 3 years ago • 1 comments

System Information

V doctor

OS: linux, Linux version 5.18.16-arch1-1 (linux@archlinux) (gcc (GCC) 12.1.1 20220730, GNU ld (GNU Binutils) 2.38) #1 SMP PREEMPT_DYNAMIC Wed, 03 Aug 2022 11:25:04 +0000
Processor: 16 cpus, 64bit, little endian, AMD Ryzen 7 5800X 8-Core Processor
CC version: cc (GCC) 12.1.1 20220730

getwd: /home/mikolaj/Documents/External-Software/vls
vmodules: /home/mikolaj/.vmodules
vroot: /usr/lib/vlang
vexe: /usr/lib/vlang/v
vexe mtime: 2022-08-08 19:41:07
is vroot writable: false
is vmodules writable: true
V full version: V 0.3.0 ec75860

VLS info

Commit f890f35

Problem Description

VLS cannot be compiled with V 0.3.0

Expected Output

VLS to successfully compile on V 0.3.0

Actual Output

$ v run build.vsh gcc
> Building VLS...
v -g -gc boehm -d use_libbacktrace -cc gcc cmd/vls -o /home/mikolaj/Documents/External-Software/vls/bin/vls
jsonrpc/server.v:75:10: notice: `io.Eof` doesn't implement method `msg` of interface `IError`. The usage of fields is being deprecated in favor of methods.
   73 |     defer { s.req_buf.go_back_to(0) }
   74 |     s.stream.read(mut s.req_buf) or {
   75 |         if err is io.Eof {
      |                ~~
   76 |             return
   77 |         }
jsonrpc/server.v:75:10: notice: `io.Eof` doesn't implement method `code` of interface `IError`. The usage of fields is being deprecated in favor of methods.
   73 |     defer { s.req_buf.go_back_to(0) }
   74 |     s.stream.read(mut s.req_buf) or {
   75 |         if err is io.Eof {
      |                ~~
   76 |             return
   77 |         }
cmd/vls/streams.v:43:10: notice: `void` doesn't implement method `msg` of interface `IError`. The usage of fields is being deprecated in favor of methods.
   41 |     stdin_file := stream.stdin_file()
   42 |     initial_len := get_raw_input(stdin_file, mut buf) or {
   43 |         return IError(io.Eof{})
      |                ~~~~~~~~~~~~~~~~
   44 |     }
   45 |     if buf.len < 1 || !buf.bytestr().starts_with(content_length) {
cmd/vls/streams.v:43:10: notice: `void` doesn't implement method `code` of interface `IError`. The usage of fields is being deprecated in favor of methods.
   41 |     stdin_file := stream.stdin_file()
   42 |     initial_len := get_raw_input(stdin_file, mut buf) or {
   43 |         return IError(io.Eof{})
      |                ~~~~~~~~~~~~~~~~
   44 |     }
   45 |     if buf.len < 1 || !buf.bytestr().starts_with(content_length) {
jsonrpc/server.v:75:13: error: is: type `io.Eof` does not exist
   73 |     defer { s.req_buf.go_back_to(0) }
   74 |     s.stream.read(mut s.req_buf) or {
   75 |         if err is io.Eof {
      |                   ~~
   76 |             return
   77 |         }
cmd/vls/streams.v:20:2: error: `&StdioStream` incorrectly implements method `read` of interface `io.ReaderWriter`: expected return type `?int`
   18 |         C._setmode(C._fileno(C.stdout), 0x8000)
   19 |     }
   20 |     return stream
      |     ~~~~~~~~~~~~~
   21 | }
   22 |
Details: io.ReaderWriter has `fn read(mut x io.ReaderWriter, mut buf []u8) ?int`
         main.StdioStream has `fn read(mut stream main.StdioStream, mut buf []u8) !int`
cmd/vls/streams.v:43:20: error: unknown type `io.Eof`
   41 |     stdin_file := stream.stdin_file()
   42 |     initial_len := get_raw_input(stdin_file, mut buf) or {
   43 |         return IError(io.Eof{})
      |                          ~~~~~
   44 |     }
   45 |     if buf.len < 1 || !buf.bytestr().starts_with(content_length) {
cmd/vls/streams.v:120:2: error: `&SocketStream` incorrectly implements method `read` of interface `io.ReaderWriter`: expected return type `?int`
  118 |     }
  119 | 
  120 |     return stream
      |     ~~~~~~~~~~~~~
  121 | }
  122 |
Details: io.ReaderWriter has `fn read(mut x io.ReaderWriter, mut buf []u8) ?int`
         main.SocketStream has `fn read(mut sck main.SocketStream, mut buf []u8) !int`
cmd/vls/streams.v:137:2: error: `&SocketStream` incorrectly implements method `read` of interface `io.ReaderWriter`: expected return type `?int`
  135 |         reader: reader
  136 |     }
  137 |     return stream
      |     ~~~~~~~~~~~~~
  138 | }
  139 |
Details: io.ReaderWriter has `fn read(mut x io.ReaderWriter, mut buf []u8) ?int`
         main.SocketStream has `fn read(mut sck main.SocketStream, mut buf []u8) !int`
cmd/vls/streams.v:177:21: error: unknown type `io.Eof`
  175 |         // read header line
  176 |         got_header := sck.reader.read_line() or {
  177 |             return IError(io.Eof{})
      |                              ~~~~~
  178 |         }
  179 |         buf << got_header.bytes()
cmd/vls/streams.v:191:22: error: unknown type `io.Eof`
  189 |             // read blank line
  190 |             empty := sck.reader.read_line() or {
  191 |                 return IError(io.Eof{})
      |                                  ~~~~~
  192 |             }
  193 |             buf << empty.bytes()
cmd/vls/streams.v:208:22: error: unknown type `io.Eof`
  206 |         for read_data_len := 0; read_data_len != conlen; {
  207 |             read_data_len = sck.reader.read(mut rbody) or {
  208 |                 return IError(io.Eof{})
      |                                  ~~~~~
  209 |             }
  210 |         }
Failed building VLS

Steps to Reproduce

git clone https://github.com/vlang/vls
cd vls
v run build.vsh gcc

Last Recorded LSP Requests

n/a

MKuranowski avatar Aug 10 '22 07:08 MKuranowski

@MKuranowski please update your installation of V.

nedpals avatar Aug 11 '22 12:08 nedpals

Closed as this is a non-VLS issue and more of an issue with outdated version of V.

nedpals avatar Aug 20 '22 03:08 nedpals