Compilation error when using `nested list()`

Open
#885 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
cpp, php
Domain
compilers

Research direction

Reproduce the example in index.php and inspect the compiler failure reported at gen-tree-postprocess.cpp:166. Trace nested list() handling during the Gen tree postprocess stage, then verify that the example compiles and prints 1, 2, and 3 as shown.

Written by the indexing model from the issue text.

Description

bug compiler

Example code:

<?php
list($a, list($b, $c)) = array(1, array(2, 3));
var_dump($a, $b, $c);

Current output(Error):

Compilation error at stage: Gen tree postprocess, gen by gen-tree-postprocess.cpp:166
  index.php:3  in global scope
    list($a, list($b, $c)) = array(1, array(2, 3));

Unexpected list() not as left side of assignment

Expected output:

int(1)
int(2)
int(3)
Dominant language
C++
Stars
1.5k
Forks
116
Avg merge
5d 17h
Merged PRs (30d)
11

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from VKCOM/kphp

All issues in VKCOM/kphp

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.