---
id: pr-triton-10004
repo: triton-lang/triton
pr: 10004
title: Fix nested `def` in `@triton.jit` to raise intended `UnsupportedLanguageConstruct`
author: swjng
date: '2026-04-22'
url: https://github.com/triton-lang/triton/pull/10004
source_category: upstream-code
architectures:
- sm100
tags:
- triton kernel
techniques: []
hardware_features: []
kernel_types: []
languages:
- cuda-cpp
- triton
captured_at: '2026-05-16'
status: merged
merge_sha: e6ecb6dce2a4a88756615648d185fd2aac21ce29
inclusion_reason: Search-matched CUDA kernel optimization PR; materialize diff/source before synthesis.
changed_paths:
- python/test/unit/language/test_compile_errors.py
- python/triton/compiler/code_generator.py
artifact_dir: evidence/pull-bundles/triton/gh-10004
head_ref_oid: 019d206d5bdc6e738ecce06204ea8b093ea8c6bb
---
# Fix nested `def` in `@triton.jit` to raise intended `UnsupportedLanguageConstruct`

- Repository: `triton-lang/triton`
- PR: [10004](https://github.com/triton-lang/triton/pull/10004)
- Decision: `Search-matched CUDA kernel optimization PR; materialize diff/source before synthesis.`
- Reason: Search-matched CUDA kernel optimization PR; materialize diff/source before synthesis.

## Changed Paths

- `python/test/unit/language/test_compile_errors.py`
- `python/triton/compiler/code_generator.py`

## Evidence Bundle

`evidence/pull-bundles/triton/gh-10004`
