Gitlab anchor variable priority

CI_COMMIT_BRANCH = dev

Have this .gitlab-ci.yml

stages:
 - test


.test: &test_it
 variables:
   var1: "test_it-${CI_COMMIT_BRANCH}"
 script:
   - echo ${var1}

just_test:
  stage: test
  <<: *test_it
  variables:
    var1: "test-${CI_COMMIT_BRANCH}"

result is: test-dev

Why test_it variable is ignored?
echo result is empty If no var1 in just_test exists